樹心幽徑

20190126為遠端的Image加裝Fedora Workstation桌面
2019/01/26,07:00

(0)#  sudo -i

(1) 將dev dev/pts dev/shm proc sys run 等六個根目錄(/)下的目錄改掛在/fc28下:

# for i in dev dev/pts dev/shm proc sys run; do mount -o bind /$i /fc28/$i; done


(2)改變/usr/bin/bash的根目錄為/fc28

# chroot /fc28 /usr/bin/bash --login

 

(3)安裝Fedora Workstation在/fc28

# dnf -y groupinstall "Fedora Workstation"

(4) # dnf -y remove gnome-initial-setup

(5-1)# systemctl disable sshd.service
Removed /etc/systemd/system/multi-user.target.wants/sshd.service.

(5-2)# systemctl enable gdm.service
Created symlink /etc/systemd/system/display-manager.service → /usr/lib/systemd/system/gdm.service.

(5-3)# systemctl set-default graphical.target
Created symlink /etc/systemd/system/default.target → /usr/lib/systemd/system/graphical.target.

(5-4)# sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/sysconfig/selinux

(5-5) #sudo dnf install ibus-rime

(6) # for i in run sys proc dev/shm dev/pts dev; do umount /fc28/$i; done

#  date
六  1月 26 07:09:26 CST 2019

(7)執行qemu-system-x86_64 -machine 虛擬機器,終於可載入GNOME

# qemu-system-x86_64 -machine accel=kvm -m 1024 -drive if=pflash,format=raw,unit=0,file=/usr/share/edk2/ovmf/OVMF_CODE.fd,readonly=on -drive if=pflash,format=raw,unit=1,file=$HOME/OVMF_VARS.fd -drive if=ide,format=raw,file=$HOME/uefi.img -net bridge,br=br0 -net nic,model=virtio

(8)qemu虛擬機器執行成功的畫面如下:

alt

(9-1)因colord無法啟動而無法進入gnome,請先執行如下指令:

$ ls /var/lib/colord/ -l
總計 44
drwxr-xr-x. 2 colord colord     6  3月 12  2018 icc
-rw-r--r--. 1 colord colord 16384  2月 11 13:19 mapping.db
-rw-r--r--. 1 colord colord 28672  2月 11 13:19 storage.db

$sudo  cp  /var/lib/colord/*.db  /fc28/var/lib/colord

$sudo  chown colord.colord /fc28/var/lib/colord/*.db

(9-2)

$  xrandr
Screen 0: minimum 320 x 200, current 1920 x 1080, maximum 8192 x 8192
XWAYLAND0 connected 1920x1080+0+0 (normal left inverted right x axis y axis) 520mm x 290mm
   1920x1080     59.96*+

[treehrt@sice ~]$  journalctl|grep colord

:

 2月 21 19:45:48 sice.home.idv.tw dbus-daemon[816]: [system] Activating via systemd: service name='org.freedesktop.ColorManager' unit='colord.service' requested by ':1.60' (uid=42 pid=1492 comm="/usr/libexec/gsd-color ")
 2月 21 19:49:35 sice.home.idv.tw sudo[2779]:  treehrt : TTY=pts/0 ; PWD=/home/treehrt ; USER=root ; COMMAND=/usr/bin/cp /var/lib/colord/*.gdb /fc28/var/lib/colord
 2月 21 19:50:23 sice.home.idv.tw sudo[2813]:  treehrt : TTY=pts/0 ; PWD=/home/treehrt ; USER=root ; COMMAND=/usr/bin/cp /var/lib/colord/mapping.db /var/lib/colord/storage.db /fc28/var/lib/colord
 2月 21 19:52:00 sice.home.idv.tw sudo[2970]:  treehrt : TTY=pts/0 ; PWD=/home/treehrt ; USER=root ; COMMAND=/usr/bin/chown colord.colord /fc28/var/lib/colord/mapping.db /fc28/var/lib/colord/storage.db

ls /fc28/usr/share/polkit-1/actions |grep color
org.freedesktop.color.policy

 

(9-3)

[liveuser@sice_client01 ~]$ sudo journalctl|grep color
 

Feb 21 11:55:50 localhost kernel: efifb: Truecolor: size=8:8:8:8, shift=24:16:8:0
Feb 21 11:56:17 sice_client01.home.idv.tw dbus-daemon[750]: [system] Activating via systemd: service name='org.freedesktop.ColorManager' unit='colord.service' requested by ':1.45' (uid=42 pid=1232 comm="/usr/libexec/gsd-color ")
Feb 21 11:56:17 sice_client01.home.idv.tw colord[1314]: failed to get edid data: EDID length is too small
Feb 21 11:56:18 sice_client01.home.idv.tw gsd-color[1232]: failed to get edid: unable to get EDID for output
Feb 21 11:56:19 sice_client01.home.idv.tw gsd-color[1232]: unable to get EDID for xrandr-Virtual-1: unable to get EDID for output
Feb 21 11:56:41 sice_client01.home.idv.tw gsd-color[1232]: unable to get EDID for xrandr-Virtual-1: unable to get EDID for output
Feb 21 11:56:41 sice_client01.home.idv.tw gsd-color[1232]: unable to get EDID for xrandr-Virtual-1: unable to get EDID for output
Feb 21 11:57:11 sice_client01.home.idv.tw gsd-color[1232]: unable to get EDID for xrandr-Virtual-1: unable to get EDID for output
Feb 21 11:57:11 sice_client01.home.idv.tw gsd-color[1232]: unable to get EDID for xrandr-Virtual-1: unable to get EDID for output
Feb 21 11:57:15 sice_client01.home.idv.tw gsd-color[1232]: unable to get EDID for xrandr-Virtual-1: unable to get EDID for output
Feb 21 11:57:15 sice_client01.home.idv.tw gsd-color[1232]: unable to get EDID for xrandr-Virtual-1: unable to get EDID for output

REF:https://fedoramagazine.org/how-to-build-a-netboot-server-part-1/

20190124用iPXE原始碼編譯製作並使用ipxe開機隨身碟ok
2019/01/25,09:57

REF:http://ipxe.org/start

REF:https://www.itread01.com/content/1516955979.html

(1)下載預先建妥的二進位版ipxe.iso

wget http://boot.ipxe.org/ipxe.iso

(2)$ lsblk
NAME    MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
:

sdd       8:48   1  57.9G  0 disk
├─sdd1    8:49   1 476.9M  0 part /run/media/treehrt/fat
├─sdd2    8:50   1     1K  0 part
├─sdd5    8:53   1   4.7G  0 part /run/media/treehrt/cdc78728-9b69-415f-8029-e9a
├─sdd6    8:54   1   4.7G  0 part /run/media/treehrt/86a0e3b0-ef7b-4d65-8340-874
├─sdd7    8:55   1   953M  0 part /run/media/treehrt/a624da69-9c7d-45c6-8f58-e04
├─sdd8    8:56   1   8.4G  0 part /run/media/treehrt/1012f56f-f864-4552-8622-6e7
├─sdd9    8:57   1   4.7G  0 part /run/media/treehrt/b8ab1e6f-7c6c-4e5d-845e-913
├─sdd10   8:58   1   1.9G  0 part
└─sdd11   8:59   1  32.2G  0 part /run/media/treehrt/298f4731-ba80-4c91-9873-3eb
:

(3)

$ umount /run/media/treehrt/fat
$ lsblk

:

sdd                             8:48   1  57.9G  0 disk
├─sdd1                          8:49   1 476.9M  0 part
├─sdd2                          8:50   1     1K  0 part
├─sdd5                          8:53   1   4.7G  0 part /run/media/treehrt/cdc78728-9b69-415f-8029-e9a38116d98c
├─sdd6                          8:54   1   4.7G  0 part /run/media/treehrt/86a0e3b0-ef7b-4d65-8340-87411e14175b
├─sdd7                          8:55   1   953M  0 part /run/media/treehrt/a624da69-9c7d-45c6-8f58-e04025123056
├─sdd8                          8:56   1   8.4G  0 part /run/media/treehrt/1012f56f-f864-4552-8622-6e7544824e53
├─sdd9                          8:57   1   4.7G  0 part /run/media/treehrt/b8ab1e6f-7c6c-4e5d-845e-913cfa882f18
├─sdd10                         8:58   1   1.9G  0 part
└─sdd11                         8:59   1  32.2G  0 part /run/media/treehrt/298f4731-ba80-4c91-9873-3ebc10c44fc7
:

(4)$ sudo dd if=ipxe.iso of=/dev/sdd bs=1M
[sudo] password for treehrt:
0+1 records in
0+1 records out
714752 bytes (715 kB, 698 KiB) copied, 0.0490677 s, 14.6 MB/s

 

(5)安裝git

$ sudo apt install -y git

(6)用git取得iPXE 的原始碼:

$git clone git://git.ipxe.org/ipxe.git


(7)編譯產生ipxe.usb

$ cd ipxe/src

$ make

$ make bin/ipxe.usb


(8)列出編譯的結果集:

$ ls bin/ipxe.usb -l
-rw-rw-r-- 1 treehrt treehrt 1409024  1月 25 19:07 bin/ipxe.usb

$ ls bin/ipxe.* -l
-rw-rw-r-- 1 treehrt treehrt  330752  1月 25 19:07 bin/ipxe.dsk
-rwxrwxr-x 1 treehrt treehrt 7925192  1月 25 19:07 bin/ipxe.dsk.tmp
-rw-rw-r-- 1 treehrt treehrt 2018961  1月 25 19:07 bin/ipxe.dsk.tmp.map
-rwxrwxr-x 1 treehrt treehrt 7924788  1月 25 19:07 bin/ipxe.hd.tmp
-rw-rw-r-- 1 treehrt treehrt 2018060  1月 25 19:07 bin/ipxe.hd.tmp.map
-rw-rw-r-- 1 treehrt treehrt   34816  1月 25 19:07 bin/ipxe.iso
-rw-rw-r-- 1 treehrt treehrt  331390  1月 25 19:07 bin/ipxe.lkrn
-rwxrwxr-x 1 treehrt treehrt 7932788  1月 25 19:07 bin/ipxe.lkrn.tmp
-rw-rw-r-- 1 treehrt treehrt 2022448  1月 25 19:07 bin/ipxe.lkrn.tmp.map
-rw-rw-r-- 1 treehrt treehrt  332017  1月 25 19:07 bin/ipxe.pxe
-rwxrwxr-x 1 treehrt treehrt 7942776  1月 25 19:07 bin/ipxe.pxe.tmp
-rw-rw-r-- 1 treehrt treehrt 2027927  1月 25 19:07 bin/ipxe.pxe.tmp.map
-rw-rw-r-- 1 treehrt treehrt 1409024  1月 25 19:07 bin/ipxe.usb

(9)察看檔案系統現況:

$ df
檔案系統         1K-區段      已用      可用 已用% 掛載點

:

/dev/sdd             698       698         0  100% /media/treehrt/iPXE


(10)用dd指令將編妥的bin/ipxe.usb展開寫入usb隨身碟(/dev/sdd)。

$ dd if=bin/ipxe.usb of=/dev/sdd
輸入 2752+0 個紀錄
輸出 2752+0 個紀錄
1409024 bytes (1.4 MB, 1.3 MiB) copied, 0.187105 s, 7.5 MB/s

 

(11)以usb中的ipxe開機成功。

 

20190124為Fedora 28 server 的用戶建立 Boot Loader並用 QEMU測試遠端以fedora28開機成功
2019/01/24,15:50

REF:https://fedoramagazine.org/how-to-build-a-netboot-server-part-1/

(1)安裝git 分散式版本控制軟體 (林納斯·托瓦茲為管理Linux內核開發而設計的)

$ sudo dnf install -y git


(2)用git來下載iPXE (一種開放源碼的the Preboot eXecution Environment (PXE) client firmware and bootloader)

 $ git clone http://git.ipxe.org/ipxe.git $HOME/ipxe

 

(3)建立iPXE bootloader 的啟動批次命令集(startup script)

$ cat << 'END' > $HOME/ipxe/init.ipxe
> #!ipxe
>
> prompt --key 0x02 --timeout 2000 Press Ctrl-B for the iPXE command line... && shell ||
>
> dhcp || exit
> set prefix file:///linux
> chain ${prefix}/boot.cfg || exit
> END

(4) $ cat $HOME/ipxe/init.ipxe
#!ipxe

prompt --key 0x02 --timeout 2000 Press Ctrl-B for the iPXE command line... && shell ||

dhcp || exit
set prefix file:///linux
chain ${prefix}/boot.cfg || exit

 

(5-1)啟用file下載協定

$ echo '#define DOWNLOAD_PROTO_FILE' > $HOME/ipxe/src/config/local/general.h


(5-2)安裝c語言工具、程式庫。

$ sudo dnf groupinstall -y "C Development Tools and Libraries"

(6)編譯產生boot loader

$ cd $HOME/ipxe/src

$ make clean

$ make bin-x86_64-efi/ipxe.efi EMBED=../init.ipxe

 

(7)記住boot loader的位置

$ IPXE_FILE="$HOME/ipxe/src/bin-x86_64-efi/ipxe.efi"

 

(8)建立EFI系統分割所需的目錄樹及檔案

mkdir -p $HOME/esp/efi/boot

mkdir $HOME/esp/linux

cp $IPXE_FILE $HOME/esp/efi/boot/bootx64.efi

$  DEFAULT_VER=$(ls -c /fc28/lib/modules | head -n 1)

cat << END > $HOME/esp/linux/boot.cfg
> #!ipxe
>
> kernel --name kernel.efi \${prefix}/vmlinuz-$DEFAULT_VER
> initrd=initrd.img ro ip=dhcp rd.peerdns=0 nameserver=192.168.1.1
> nameserver=163.25.20.1 root=nfs4:sice.home.idv.tw:/fc28  console=tty0 console=ttyS0,115200n8 audit=0 selinux=0 quiet
> initrd --name initrd.img \${prefix}/initramfs-$DEFAULT_VER.img
> boot || exit
> END

$ cat  $HOME/esp/linux/boot.cfg
#!ipxe

kernel --name kernel.efi ${prefix}/vmlinuz-4.19.16-200.fc28.x86_64
initrd=initrd.img ro ip=dhcp rd.peerdns=0 nameserver=192.168.1.1
nameserver=163.25.20.1 root=nfs4:sice.home.idv.tw:/fc28  console=tty0 console=ttyS0,115200n8 audit=0 selinux=0 quiet
initrd --name initrd.img ${prefix}/initramfs-4.19.16-200.fc28.x86_64.img
boot || exit

(9-1)將核心(vmlinuz-4.19.16-200.fc28.x86_64)拷到$HOME/esp/linux中。

$ cp $(find /fc28/lib/modules -maxdepth 2 -name 'vmlinuz' | grep -m 1 $DEFAULT_VER) $HOME/esp/linux/vmlinuz-$DEFAULT_VER

(9-2)將初始記憶體檔案系統(initramfs-4.19.16-200.fc28.x86_64.img)拷到$HOME/esp/linux中。

$ sudo cp $(find /fc28/boot -name 'init*' | grep -m 1 $DEFAULT_VER) $HOME/esp/linux/initramfs-$DEFAULT_VER.img

$ tree ~/esp
/home/treehrt/esp
├── efi
│   └── boot
│       └── bootx64.efi
└── linux
    ├── boot.cfg
    ├── initramfs-4.19.16-200.fc28.x86_64.img
    └── vmlinuz-4.19.16-200.fc28.x86_64

3 directories, 4 files

 

(10)安裝磁碟分割工具 parted 及dosfstools

$ sudo dnf install -y parted dosfstools


(11)建立uefi.img檔並拷入esp目錄

$ ESP_SIZE=$(du -ks $HOME/esp | cut -f 1)

$ echo $ESP_SIZE
55964

$ dd if=/dev/zero of=$HOME/uefi.img count=$((${ESP_SIZE}+5000)) bs=1KiB
60964+0 records in
60964+0 records out
62427136 bytes (62 MB, 60 MiB) copied, 0.0828752 s, 753 MB/s

$ UEFI_DEV=$(sudo losetup --show -f $HOME/uefi.img)

$ echo $UEFI_DEV
/dev/loop0

$ sudo parted ${UEFI_DEV} -s mklabel gpt mkpart EFI FAT16 1MiB 100% toggle 1 boot

$ sudo mkfs -t msdos ${UEFI_DEV}p1

mkfs.fat 4.1 (2017-01-24)

$ mkdir -p $HOME/mnt

$ sudo mount ${UEFI_DEV}p1 $HOME/mnt

$ sudo cp -r $HOME/esp/* $HOME/mnt

$ tree  $HOME/mnt

/home/treehrt/mnt
├── efi
│   └── boot
│       └── bootx64.efi
└── linux
    ├── boot.cfg
    ├── initramfs-4.19.16-200.fc28.x86_64.img
    └── vmlinuz-4.19.16-200.fc28.x86_64

3 directories, 4 files

$ df
檔案系統                               1K-區段    已用    可用 已用% 掛載點
:

/dev/loop0p1                             59784   55962    3822   94% /home/treehrt/mnt

$ sudo umount $HOME/mnt

$ sudo losetup -d ${UEFI_DEV}

(12) 安裝qemu-system-x86

sudo dnf install -y qemu-system-x86

註:QEMU is a generic and open source machine emulator and virtualizer。

 

 

(13)允許qemu存取bridge br0

sudo su -

# echo 'allow br0' > /etc/qemu/bridge.conf

# exit

(14)拷入qemu-system-x86虛擬機器所需的bios設定

$ cp /usr/share/edk2/ovmf/OVMF_VARS.fd $HOME

(15)執行qemu-system-x86虛擬機器失敗, 進入UEFI Interactive Shell

qemu-system-x86_64 -machine accel=kvm -nographic -m 1024 -drive if=pflash,format=raw,unit=0,file=/usr/share/edk2/ovmf/OVMF_CODE.fd,readonly=on -drive if=pflash,format=raw,unit=1,file=$HOME/OVMF_VARS.fd -drive if=ide,format=raw,file=$HOME/uefi.img -net bridge,br=br0 -net nic,model=virtio

:

UEFI Interactive Shell v2.2
EDK II
UEFI v2.70 (EDK II, 0x00010000)
Mapping table
:

 Press ESC in 1 seconds to skip startup.nsh or any other key to continue.
Shell>

(16) 將BIOS的Secure Boot選項 Disable並進階CPU選項:Intel(R) Virtualization Technology要enable

(17)重新執行qemu-system-x86虛擬機器失敗(mount.nfs4: Connection timed out)

qemu-system-x86_64 -machine accel=kvm -nographic -m 1024 -drive if=pflash,format=raw,unit=0,file=/usr/share/edk2/ovmf/OVMF_CODE.fd,readonly=on -drive if=pflash,format=raw,unit=1,file=$HOME/OVMF_VARS.fd -drive if=ide,format=raw,file=$HOME/uefi.img -net bridge,br=br0 -net nic,model=virtio

出現訊息如下

iPXE initialising devices...ok
iPXE 1.0.0+ (de45) -- Open Source Network Boot Firmware -- http://ipxe.org
Features: DNS HTTP iSCSI TFTP SRP AoE EFI Menu
Configuring (net0 52:54:00:12:34:56)...... ok
file:///linux/boot.cfg... ok
file:///linux/vmlinuz-4.19.16-200.fc28.x86_64... ok
file:///linux/initramfs-4.19.16-200.fc28.x86_64.img... ok
[    3.556745] dracut-initqueue[301]: RTNETLINK answers: File exists
[  267.323393] dracut-initqueue[301]: mount.nfs4: Connection timed out          [  394.250823] dracut-initqueue[301]: Warning: dracut-initqueue timeout - starting timeout scripts
[  394.784444] dracut-initqueue[301]: Warning: dracut-initqueue timeout - starting timeout scripts

 

(18) 修改nfs server的指定方式:不用DNS name, 改用ip:192.168.1.103:

$ vi  $HOME/esp/linux/boot.cfg
#!ipxe

kernel --name kernel.efi ${prefix}/vmlinuz-4.19.16-200.fc28.x86_64
initrd=initrd.img ro ip=dhcp rd.peerdns=0 nameserver=192.168.1.1
nameserver=163.25.20.1 root=nfs4:192.168.1.103:/fc28  console=tty0 console=ttyS0,115200n8 audit=0 selinux=0 quiet
initrd --name initrd.img ${prefix}/initramfs-4.19.16-200.fc28.x86_64.img
boot || exit

(19)執行qemu-system-x86虛擬機器,終於成功

qemu-system-x86_64 -machine accel=kvm -nographic -m 1024 -drive if=pflash,format=raw,unit=0,file=/usr/share/edk2/ovmf/OVMF_CODE.fd,readonly=on -drive if=pflash,format=raw,unit=1,file=$HOME/OVMF_VARS.fd -drive if=ide,format=raw,file=$HOME/uefi.img -net bridge,br=br0 -net nic,model=virtio

(20)成功畫面如下: 

alt

 

colord usage: https://www.freedesktop.org/software/colord/using.html

20190123Install KVM on Fedora 28(未成)
2019/01/23,20:28

REF:https://computingforgeeks.com/how-to-install-kvm-on-fedora-29-fedora-28/

(1)$ cat /proc/cpuinfo | egrep "vmx|svm"

(2)$ sudo dnf -y install bridge-utils libvirt virt-install qemu-kvm

(3)$ lsmod | grep kvm

kvm_intel             241664  0
kvm                   737280  1 kvm_intel
irqbypass              16384  1 kvm

(4)$ sudo dnf -y install virt-top libguestfs-tools

(5)$ sudo systemctl start libvirtd
(6)$ sudo systemctl enable libvirtd

(7)$ sudo dnf -y install virt-manager

(8)$ df

 檔案系統                               1K-區段    已用    可用 已用% 掛載點
devtmpfs                               3996188       0 3996188    0% /dev
tmpfs                                  4011856   60700 3951156    2% /dev/shm
tmpfs                                  4011856    1948 4009908    1% /run
tmpfs                                  4011856       0 4011856    0% /sys/fs/cgroup
/dev/mapper/fedora_treehrt--fire-root 15718400 6518444 9199956   42% /
tmpfs                                  4011856   37816 3974040    1% /tmp
/dev/sdb1                               999320  148872  781636   16% /boot
tmpfs                                   802368      16  802352    1% /run/user/42
tmpfs                                   802368    6984  795384    1% /run/user/1000

(9)$ sudo virt-install --name fed28 --ram 1024 --vcpus 1 --disk path=/fed28.img,size=20 --os-variant fedora28 --os-type linux --network bridge=br0 --graphics none --console pty,target_type=serial --location 'http://fedora.inode.at/releases/28/Server/x86_64/os/'
WARNING  KVM acceleration not available, using 'qemu'
WARNING  The requested volume capacity will exceed the available pool space when the volume is fully allocated. (20480 M requested capacity > 8190 M available)
ERROR    The requested volume capacity will exceed the available pool space when the volume is fully allocated. (20480 M requested capacity > 8190 M available) (Use --check disk_size=off or --check all=off to override)

(9)$ sudo virt-install --name fed28 --ram 1024 --vcpus 1 --disk path=/fed28.img,size=20 --os-variant fedora28 --os-type linux --network bridge=br0 --graphics none --console pty,target_type=serial --location 'http://fedora.inode.at/releases/28/Server/x86_64/os/' --check all=off
WARNING  KVM acceleration not available, using 'qemu'
WARNING  The requested volume capacity will exceed the available pool space when the volume is fully allocated. (20480 M requested capacity > 8190 M available)
WARNING  Did not find 'console=ttyS0' in --extra-args, which is likely required to see text install output from the guest.

Starting install...
Retrieving file vmlinuz...                                                                                                                                                                  | 7.9 MB  00:00:06    
Retrieving file initrd.img...                                                                                                                                                               |  65 MB  00:00:35    
Allocating 'fed28.img'                                                                                                                                                                      |  20 GB  00:00:00    
Connected to domain fed28
Escape character is ^]

:


^]Domain installation still in progress. You can reconnect to
the console to complete the installation process.
[treehrt@sice ~]$

 

[treehrt@sice ~]$ ls /fed28.img -l
-rw-------. 1 qemu qemu 21478375424 Jan 23 20:51 /fed28.img
[treehrt@sice ~]$

 

(10)$ ps ax|grep virt
 1518 ?        S      0:00 /usr/sbin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.conf --leasefile-ro --dhcp-script=/usr/libexec/libvirt_leaseshelper
 1519 ?        S      0:00 /usr/sbin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.conf --leasefile-ro --dhcp-script=/usr/libexec/libvirt_leaseshelper
 5006 ?        Ssl    0:00 /usr/sbin/libvirtd
 7789 pts/0    S+     0:00 sudo virt-install --name fed28 --ram 1024 --vcpus 1 --disk path=/fed28.img,size=20 --os-variant fedora28 --os-type linux --network bridge=br0 --graphics none --console pty,target_type=serial --location http://fedora.inode.at/releases/28/Server/x86_64/os/ --check all=off
 7791 pts/0    Sl+    0:04 /usr/bin/python2 /usr/share/virt-manager/virt-install --name fed28 --ram 1024 --vcpus 1 --disk path=/fed28.img,size=20 --os-variant fedora28 --os-type linux --network bridge=br0 --graphics none --console pty,target_type=serial --location http://fedora.inode.at/releases/28/Server/x86_64/os/ --check all=off
 7838 ?        Ssl    0:00 /usr/sbin/virtlogd
 7846 ?        Sl    10:42 /usr/bin/qemu-system-x86_64 -name guest=fed28,debug-threads=on -S -object secret,id=masterKey0,format=raw,file=/var/lib/libvirt/qemu/domain-1-fed28/master-key.aes -machine pc-i440fx-2.11,accel=tcg,usb=off,dump-guest-core=off -m 1024 -realtime mlock=off -smp 1,sockets=1,cores=1,threads=1 -uuid 1d9f2ad3-ead7-44a8-99b6-9bb59609d7a5 -display none -no-user-config -nodefaults -chardev socket,id=charmonitor,path=/var/lib/libvirt/qemu/domain-1-fed28/monitor.sock,server,nowait -mon chardev=charmonitor,id=monitor,mode=control -rtc base=utc,driftfix=slew -global kvm-pit.lost_tick_policy=delay -no-hpet -no-reboot -global PIIX4_PM.disable_s3=1 -global PIIX4_PM.disable_s4=1 -boot strict=on -kernel /var/lib/libvirt/boot/virtinst-vmlinuz.l1EqUl -initrd /var/lib/libvirt/boot/virtinst-initrd.img.QeTuKH -append inst.repo=http://fedora.inode.at/releases/28/Server/x86_64/os/ -device ich9-usb-ehci1,id=usb,bus=pci.0,addr=0x3.0x7 -device ich9-usb-uhci1,masterbus=usb.0,firstport=0,bus=pci.0,multifunction=on,addr=0x3 -device ich9-usb-uhci2,masterbus=usb.0,firstport=2,bus=pci.0,addr=0x3.0x1 -device ich9-usb-uhci3,masterbus=usb.0,firstport=4,bus=pci.0,addr=0x3.0x2 -device virtio-serial-pci,id=virtio-serial0,bus=pci.0,addr=0x4 -drive file=/fed28.img,format=qcow2,if=none,id=drive-virtio-disk0 -device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x5,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 -netdev tap,fd=30,id=hostnet0 -device virtio-net-pci,netdev=hostnet0,id=net0,mac=52:54:00:b2:ec:68,bus=pci.0,addr=0x2 -chardev pty,id=charserial0 -device isa-serial,chardev=charserial0,id=serial0 -chardev socket,id=charchannel0,path=/var/lib/libvirt/qemu/channel/target/domain-1-fed28/org.qemu.guest_agent.0,server,nowait -device virtserialport,bus=virtio-serial0.0,nr=1,chardev=charchannel0,id=channel0,name=org.qemu.guest_agent.0 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x6 -object rng-random,id=objrng0,filename=/dev/urandom -device virtio-rng-pci,rng=objrng0,id=rng0,bus=pci.0,addr=0x7 -msg timestamp=on
 8075 pts/2    S+     0:00 grep --color=auto virt

 

(11)$ sudo dnf install iftop
:

Installed:
  iftop.x86_64 1.0-0.17.pre4.fc28                                                                                                                                                                                 

Complete!

(12) $ grep flags /proc/cpuinfo | grep --color vmx

flags        : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf tsc_known_freq pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb invpcid_single pti ssbd ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm mpx rdseed adx smap clflushopt intel_pt xsaveopt xsavec xgetbv1 xsaves dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp flush_l1d

:

 

20190123在Fedora 28 Server設定system locale、安裝 GNOME桌面、嘸蝦米輸入法、Firefox及LibreOffice
2019/01/23,08:01

(1)設定local

# ll /usr/lib/locale

# localectl status 

 System Locale: LANG=zh_TW.UTF-8       VC Keymap: tw      X11 Layout: tw
# cat /etc/locale.conf

LANG="zh_TW.UTF-8"

# rpm -qa *langpack*

glibc-langpack-zh-2.27-37.fc28.x86_64

langpacks-zh_TW-1.0-12.fc28.noarch

# localectl

   System Locale: LANG=zh_TW.UTF-8       VC Keymap: tw      X11 Layout: tw

# localectl list-locales

C.utf8zh_CNzh_CN.gb18030zh_CN.gbkzh_CN.utf8zh_HKzh_HK.utf8zh_SGzh_SG.gbkzh_SG.utf8zh_TWzh_TW.euctwzh_TW.utf8

# localectl set-locale LANG=C.utf8

# cat /etc/locale.conf

LANG=C.utf8

(2)安裝GUI

dnf groupinstall gnome

# dnf distro-sync

# sudo ln -s -f /etc/systemd/system/graphical.target /etc/systemd/system/default.target

# sudo systemctl enable gdm

# sudo dnf install cockpit

(3) 安裝browser

$ sudo dnf install -y firefox

 

(4)安裝嘸蝦米中文輸入法

參考:https://amoshyc.github.io/blog/2018/install-liu-with-rime.html

(4-1)$ sudo dnf install ibus-rime

重開機,以用戶treehrt登入gnome桌面

(4-2)$ cd /home/treehrt/.config/ibus/rime

(4-3)$ wget https://raw.githubusercontent.com/amoshyc/myliu/master/default.custom.yaml

(4-4)$ wget https://raw.githubusercontent.com/amoshyc/myliu/master/myliu.dict.yaml


(4-5)$ wget https://raw.githubusercontent.com/amoshyc/myliu/master/myliu.schema.yaml

(5)$ 安裝LIbreOffice

$ sudo dnf install libreoffice


20190120在Fedora 28 Netboot server 裝NFS並建立NetBoot Image
2019/01/20,16:00

上篇

(16) 建立Netboot Image所在目錄

# mkdir /fc28

(17)先裝fedora-release systemd passwd rootfiles sudo dracut dracut-network nfs-utils vim-minimal dnf等十個基本套件:

# dnf -y --releasever=28 --installroot=/fc28 install fedora-release systemd passwd rootfiles sudo dracut dracut-network nfs-utils vim-minimal dnf

註:dracut是一種事件驅動的 initramfs infrastructure,dracut指令會自裝妥的linux系統拷取必要的檔案與工具來產生initramfs。

(18-1) 不採hostonly,以利initramfs可支援多種硬體驅動程式:

# echo 'hostonly=no' > /fc28/etc/dracut.conf.d/hostonly.conf

(18-2) 設定支援nfs

# echo 'add_dracutmodules+=" network nfs "' > /fc28/etc/dracut.conf.d/netboot.conf

(18-3)再裝kernel組件

# dnf -y --installroot=/fc28 install kernel

(18-4)設定不要自動更新kernel組件

# echo 'exclude=kernel-*' >> /fc28/etc/dnf/dnf.conf

 

(19)

# echo 'exclude=kernel-*' >> /fc28/etc/dnf/dnf.conf
#  MY_CLIENT_HOSTNAME=sice-client1.home.idv.tw
#  echo $MY_CLIENT_HOSTNAME > /fc28/etc/hostname
# echo 'kernel.printk = 0 4 1 7' > /fc28/etc/sysctl.d/00-printk.conf
# echo 'liveuser:x:1000:1000::/home/liveuser:/bin/bash' >> /fc28/etc/passwd
# echo 'liveuser::::::::' >> /fc28/etc/shadow
#  echo 'liveuser:x:1000:' >> /fc28/etc/group
# echo 'liveuser:!::' >> /fc28/etc/gshadow
# echo 'liveuser ALL=(ALL) NOPASSWD: ALL' > /fc28/etc/sudoers.d/liveuser

(20)# dnf install -y --installroot=/fc28 authselect oddjob-mkhomedir

(21)

# echo 'dirs /home' > /fc28/etc/rwtab.d/home

 

# chroot /fc28 authselect select sssd with-mkhomedir --force
Backup stored at /var/lib/authselect/backups/2019-01-24-07-33-49.LpqSvR
Profile "sssd" was selected.
The following nsswitch maps are overwritten by the profile:
- passwd
- group
- netgroup
- automount
- services

Make sure that SSSD service is configured and enabled. See SSSD documentation for more information.
 
- with-mkhomedir is selected, make sure pam_oddjob_mkhomedir module
  is present and oddjobd service is enabled
  - systemctl enable oddjobd.service
  - systemctl start oddjobd.service

# chroot /fc28 systemctl enable oddjobd.service
Created symlink /etc/systemd/system/multi-user.target.wants/oddjobd.service → /usr/lib/systemd/system/oddjobd.service.

註:chroot指令用以改變所指定命令或程序的根目錄


(22)# sed -i 's/^READONLY=no$/READONLY=yes/' /fc28/etc/sysconfig/readonly-root

(23)# cat /fc28/etc/sysconfig/readonly-root
# Set to 'yes' to mount the system filesystems read-only.
# NOTE: It's necessary to append 'ro' to mount options of '/' mount point in
#       /etc/fstab as well, otherwise the READONLY option will not work.
READONLY=yes
# Set to 'yes' to mount various temporary state as either tmpfs
# or on the block device labelled RW_LABEL. Implied by READONLY
TEMPORARY_STATE=no
# Place to put a tmpfs for temporary scratch writable space
RW_MOUNT=/var/lib/stateless/writable
# Label on local filesystem which can be used for temporary scratch space
RW_LABEL=stateless-rw
# Options to use for temporary mount
RW_OPTIONS=
# Label for partition with persistent data
STATE_LABEL=stateless-state
# Where to mount to the persistent data
STATE_MOUNT=/var/lib/stateless/state
# Options to use for persistent mount
STATE_OPTIONS=
# NFS server to use for persistent data?
CLIENTSTATE=
# Use slave bind-mounts
SLAVE_MOUNTS=yes

(24-1)# sed -i 's/^#Storage=auto$/Storage=volatile/' /fc28/etc/systemd/journald.conf
(24-2)# cat /fc28/etc/systemd/journald.conf
#  This file is part of systemd.
#
#  systemd is free software; you can redistribute it and/or modify it
#  under the terms of the GNU Lesser General Public License as published by
#  the Free Software Foundation; either version 2.1 of the License, or
#  (at your option) any later version.
#
# Entries in this file show the compile time defaults.
# You can change settings by editing this file.
# Defaults can be restored by simply deleting this file.
#
# See journald.conf(5) for details.

[Journal]
Storage=volatile
#Compress=yes
#Seal=yes
#SplitMode=uid
#SyncIntervalSec=5m
#RateLimitIntervalSec=30s
#RateLimitBurst=1000
#SystemMaxUse=
#SystemKeepFree=
#SystemMaxFileSize=
#SystemMaxFiles=100
#RuntimeMaxUse=
#RuntimeKeepFree=
#RuntimeMaxFileSize=
#RuntimeMaxFiles=100
#MaxRetentionSec=
#MaxFileSec=1month
#ForwardToSyslog=no
#ForwardToKMsg=no
#ForwardToConsole=no
#ForwardToWall=yes
#TTYPath=/dev/console
#MaxLevelStore=debug
#MaxLevelSyslog=debug
#MaxLevelKMsg=notice
#MaxLevelConsole=info
#MaxLevelWall=emerg
#LineMax=48K
#ReadKMsg=yes

(25)# cat << END > /fc28/etc/resolv.conf
> nameserver 192.168.1.1
> nameserver 163.25.20.1
> END

 

(26)

# echo 'dirs /var/lib/gssproxy' > /fc28/etc/rwtab.d/gssproxy
# cat << END > /fc28/etc/rwtab.d/systemd
> dirs /var/lib/systemd/catalog
> dirs /var/lib/systemd/coredump
> END

(27)

# mkdir /export/fc28
# echo '/fc28 /export/fc28 none bind 0 0' >> /etc/fstab
#  mount /export/fc28
#  echo "/export/fc28 -ro,sec=sys,no_root_squash 192.168.1.0/24" > /etc/exports.d/fc28.exports
# exportfs -vr
exporting 192.168.1.0/24:/export/fc28
exporting 192.168.1.0/24:/export

(28)比一下:

# ls /fc28
bin  boot  dev  etc  home  lib  lib64  media  mnt  opt  proc  root  run  sbin  srv  sys  tmp  usr  var

# ls /export/fc28
bin  boot  dev  etc  home  lib  lib64  media  mnt  opt  proc  root  run  sbin  srv  sys  tmp  usr  var

# ls /
bin  boot  dev  etc  export  fc28  home  lib  lib64  media  mnt  opt  proc  root  run  sbin  srv  sys  tmp  usr  var

 

20190119用Fedora Server’s netinst images透過網路安裝Fedora 28 server最小集及NFS4網路檔案系統
2019/01/20,07:44

(1)用Fedora Server’s netinst images隨身碟開機

(不理ACPI-BIOS ERROR訊息)

安裝隨身碟製作過程詳參:http://oldwww.kmvs.km.edu.tw/lf/index.php?op=ViewArticle&articleId=471&blogId=70

(2)選Install Fedora 28

(3)安裝語言選「繁體中文(台灣)」

(4)安裝摘要:

(4-1)鍵盤配置:自選「中華民國(台灣)」

(4-2)語言支援:自選「繁體中文(台灣)」

(4-3)日期與時間:自選「亞洲/台北時區」

(4-4)網路與主機名稱:自動偵測到「enpos31f6乙太網路:IP:10.10.10.100,Gateway:10.10.10.254,DNS:10.10.10.254」

(4-5)安裝來源:自動找到「最近的鏡像站」

(4-6)軟體選擇:挑「最小安裝集」

(4-7)安裝目的地:挑「剛由win10分割區切一半出來」的/dev/sda4空間,並挑由安裝程式規畫安裝分區,動作進行如下:

刪sda4的ntfs檔案系統及分割區-->重建sda4的的分割區及ext4檔案系統-->新建sda6分割區及其上的LVM檔案系統-->新建lvmvg裝置,lvmlv裝置(SWAP)採swap格式-->新建lvmlv裝置及其上的xfs檔案系統。

(5)安裝下載323包RPM,約323MiB (用1024位元組計算的單位為 KiB、MiB、GiB、TiB)

(6)安裝中:給root密碼,並建立一個用戶

(7)安裝完成並重開機

(8)重開機後順利在文字模式用root登入系統並有網路可用,查詢系統相關資訊如下:

(8-1)列出作業系統資訊:

#uname -a

 Linux localhost.localdomain 4.19.15-200.fc28.x86_64 #1 SMP Mon Jan 14 17:06:39 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

(8-2)列出所有的區塊設備(硬碟、隨身碟、…):

# lsblk

NAME            MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT

sda               8:0    0 931.5G  0 disk
├─sda1            8:1    0   260M  0 part /boot/efi
├─sda2            8:2    0    16M  0 part
├─sda3            8:3    0   300G  0 part
├─sda4            8:4    0     1G  0 part /boot
├─sda5            8:5    0   800M  0 part
└─sda6            8:6    0 628.5G  0 part
  ├─fedora-root 253:0    0    15G  0 lvm  /
  └─fedora-swap 253:1    0   7.8G  0 lvm  [SWAP]
sr0              11:0    1  1024M  0 rom

1EFI延伸韌體介面(Extensible Firmware Interface),用以支援隨身碟開機。

2:sr0是SCSI裝置

(8-3)列出CPU資訊:架構(x86, x86_64...等等)、核心數、執行緒數、頻率和快取

# lscpu
架構:               x86_64
CPU 作業模式:       32-bit, 64-bit
Byte Order:          Little Endian
CPU(s):              4
On-line CPU(s) list: 0-3
每核心執行緒數:     1
每通訊端核心數:     4
Socket(s):           1
NUMA 節點:          1
供應商識別號:       GenuineIntel
CPU 家族:           6
型號:               158
Model name:          Intel(R) Core(TM) i5-7500 CPU @ 3.40GHz
製程:               9
CPU MHz:            1001.079
CPU max MHz:         3800.0000
CPU min MHz:         800.0000
BogoMIPS:            6816.00
虛擬:               VT-x
L1d 快取:           32K
L1i 快取:           32K
L2 快取:            256K
L3 快取:            6144K
NUMA node0 CPU(s):  0-3
Flags:               fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cm                                             ov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb                                              rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop                                             _tsc cpuid aperfmperf tsc_known_freq pni pclmulqdq dtes64 monitor ds_cpl vmx smx                                              est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt ts                                             c_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault                                              epb invpcid_single pti tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase ts                                             c_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm mpx rdseed adx smap clflushopt                                              intel_pt xsaveopt xsavec xgetbv1 xsaves dtherm ida arat pln pts hwp hwp_notify                                              hwp_act_window hwp_epp
[root@localhost ~]#

註3:以 Least Significant Byte(LSB) 逐一儲存位元組者,稱為little-endian,x86_64採用以簡化硬体設計。

(8-4)列出所有的環境變數

# env
LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=01;05;37;41:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.wim=01;31:*.swm=01;31:*.dwm=01;31:*.esd=01;31:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=01;36:*.au=01;36:*.flac=01;36:*.m4a=01;36:*.mid=01;36:*.midi=01;36:*.mka=01;36:*.mp3=01;36:*.mpc=01;36:*.ogg=01;36:*.ra=01;36:*.wav=01;36:*.oga=01;36:*.opus=01;36:*.spx=01;36:*.xspf=01;36:
SSH_CONNECTION=10.10.10.191 49256 10.10.10.100 22
LANG=zh_TW.UTF-8
HISTCONTROL=ignoredups
HOSTNAME=localhost.localdomain
XDG_SESSION_ID=5
USER=root
SELINUX_ROLE_REQUESTED=
PWD=/root
HOME=/root
SSH_CLIENT=10.10.10.191 49256 22
SELINUX_LEVEL_REQUESTED=
SSH_TTY=/dev/pts/0
MAIL=/var/spool/mail/root
TERM=xterm
SHELL=/bin/bash
SELINUX_USE_CURRENT_RANGE=
SHLVL=1
LOGNAME=root
DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/0/bus
XDG_RUNTIME_DIR=/run/user/0
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin
HISTSIZE=1000
LESSOPEN=||/usr/bin/lesspipe.sh %s
_=/usr/bin/env

(9)設定網路:

(9-1)

[root@localhost ~]# sudo -i    
[root@localhost ~]# MY_HOSTNAME=sice.kmvs.km.edu.tw
[root@localhost ~]# hostnamectl set-hostname $MY_HOSTNAME

[root@localhost ~]# MY_DNS1=168.95.1.1
[root@localhost ~]# MY_DNS2=168.95.192.1
[root@localhost ~]# MY_IP=10.10.10.100
[root@localhost ~]# MY_PREFIX=24
[root@localhost ~]# MY_GATEWAY=10.10.10.254

(9-2)

[root@localhost ~]# ip route show default
default via 10.10.10.254 dev enp0s31f6 proto dhcp metric 100
[root@localhost ~]# ip route show default|awk '{print $5}'
enp0s31f6
[root@localhost ~]# DEFAULT_DEV=$(ip route show default|awk '{print $5}')

[root@localhost ~]# nmcli d show $DEFAULT_DEV
GENERAL.DEVICE:                         enp0s31f6
GENERAL.TYPE:                           ethernet
GENERAL.HWADDR:                         B0:6E:BF:CB:C8:FB
GENERAL.MTU:                            1500
GENERAL.STATE:                          100 (已連線)
GENERAL.CONNECTION:                     enp0s31f6
GENERAL.CON-PATH:                       /org/freedesktop/NetworkManager/ActiveConnection/1
WIRED-PROPERTIES.CARRIER:               開
IP4.ADDRESS[1]:                         10.10.10.100/24
IP4.GATEWAY:                            10.10.10.254
IP4.ROUTE[1]:                           dst = 0.0.0.0/0, nh = 10.10.10.254, mt = 100
IP4.ROUTE[2]:                           dst = 10.10.10.0/24, nh = 0.0.0.0, mt = 100
IP4.DNS[1]:                             10.10.10.254
IP6.ADDRESS[1]:                         fe80::5448:a273:f1ef:fb19/64
IP6.GATEWAY:                            --
IP6.ROUTE[1]:                           dst = ff00::/8, nh = ::, mt = 256, table=255
IP6.ROUTE[2]:                           dst = fe80::/64, nh = ::, mt = 256
IP6.ROUTE[3]:                           dst = fe80::/64, nh = ::, mt = 100

 

[root@localhost ~]# nmcli d show $DEFAULT_DEV | sed -n '/^GENERAL.CONNECTION:/s!.*:\s*!! p'
enp0s31f6

 

[root@localhost ~]# DEFAULT_CON=$(nmcli d show $DEFAULT_DEV | sed -n '/^GENERAL.CONNECTION:/s!.*:\s*!! p')

(9-3)在預設連線上建立一個network bridge(br0)

[root@localhost ~]# nohup bash << END
> nmcli con mod "$DEFAULT_CON" connection.id "$DEFAULT_DEV"
> nmcli con mod "$DEFAULT_DEV" connection.interface-name "$DEFAULT_DEV"
> nmcli con mod "$DEFAULT_DEV" ipv4.method disabled
> nmcli con up "$DEFAULT_DEV"
> nmcli con add con-name br0 ifname br0 type bridge
> nmcli con mod br0 bridge.stp no
> nmcli con mod br0 ipv4.dns $MY_DNS1 , $MY_DNS2
> nmcli con mod br0 ipv4.addresses $MY_IP/$MY_PREFIX
> nmcli con mod br0 ipv4.gateway $MY_GATEWAY
> nmcli con mod br0 ipv4.method manual
> nmcli con up br0
> nmcli con add con-name br0-slave0 ifname "$DEFAULT_DEV" type bridge-slave master br0
> nmcli con up br0-slave0
> END

以上設定在預設連線上建立一個network bridge,以利日後可在伺服端執行虛擬機器。

bridge將二個區域網路整併成一個。

 

4nohup: 不理會HUP (hangup)訊號,讓目前的批次指令(script)進入背景中執行。

 

(10)安裝NFS網路檔案系統

ref:how-to-add-network-bridge-with-nmcli-networkmanager-on-linux/

[root@sice ~]# MY_HOSTNAME=sice.kmvs.km.edu.tw

[root@sice ~]#  hostnamectl set-hostname $MY_HOSTNAME
[root@sice ~]# MY_DNS1=163.25.20.1
[root@sice ~]# MY_DNS2=168.95.192.1
[root@sice ~]#  MY_IP=10.10.10.100
[root@sice ~]#  MY_PREFIX=24
[root@sice ~]#  DEFAULT_DEV=$(ip route show default|awk '{print $5}')
[root@sice ~]#  DEFAULT_CON=$(nmcli d show $DEFAULT_DEV | sed -n '/^GENERAL.CONNECTION:/s!.*:\s*!! p')


[root@sice ~]#  nohup bash << END
> nmcli con mod "$DEFAULT_CON" connection.id "$DEFAULT_DEV"
> nmcli con mod "$DEFAULT_DEV" connection.interface-name "$DEFAULT_DEV"
> nmcli con mod "$DEFAULT_DEV" ipv4.method disabled
> nmcli con up "$DEFAULT_DEV"
> nmcli con add con-name br0 ifname br0 type bridge
> nmcli con mod br0 bridge.stp no
> nmcli con mod br0 ipv4.dns $MY_DNS1,$MY_DNS2
> nmcli con mod br0 ipv4.addresses $MY_IP/$MY_PREFIX
> nmcli con mod br0 ipv4.gateway $MY_GATEWAY
> nmcli con mod br0 ipv4.method manual
> nmcli con up br0
> nmcli con add con-name br0-slave0 ifname "$DEFAULT_DEV" type bridge-slave master br0
> nmcli con up br0-slave0
> END
nohup: appending output to 'nohup.out'

 

[root@sice ~]# dnf install -y nfs-utils

:

已安裝:
  nfs-utils.x86_64 1:2.3.3-1.rc1.fc28     gssproxy.x86_64 0.8.0-4.fc28
  keyutils.x86_64 1.5.10-6.fc28           libev.x86_64 4.24-6.fc28
  libevent.x86_64 2.1.8-2.fc28            libverto-libev.x86_64 0.3.0-5.fc28
  quota.x86_64 1:4.04-7.fc28              quota-nls.noarch 1:4.04-7.fc28
  rpcbind.x86_64 0.2.4-10.rc3.fc28

完成!


(11)

[root@sice ~]# MY_SUBNET=10.10.10.0

[root@sice ~]# mkdir /export

[root@sice ~]# echo "/export -fsid=0,ro,sec=sys,root_squash $MY_SUBNET/$MY_PREFIX" > /etc/exports

(12)

[root@sice ~]# cat /etc/default/grub
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="resume=/dev/mapper/fedora-swap rd.lvm.lv=fedora/root rd.lvm.lv=fedora/swap rhgb quiet"
GRUB_DISABLE_RECOVERY="true"
[root@sice ~]#

[root@sice ~]# sed -i  '/GRUB_CMDLINE_LINUX/s/"$/ audit=0 selinux=0"/' /etc/default/grub

[root@sice ~]# cat /etc/default/grub
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="resume=/dev/mapper/fedora-swap rd.lvm.lv=fedora/root rd.lvm.lv=fedora/swap rhgb quiet audit=0 selinux=0"
GRUB_DISABLE_RECOVERY="true"

(13)

[root@sice ~]# grub2-mkconfig -o /boot/grub2/grub.cfg
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-4.19.15-200.fc28.x86_64
Found initrd image: /boot/initramfs-4.19.15-200.fc28.x86_64.img
Found linux image: /boot/vmlinuz-0-rescue-467ee3274b0447fe82e1fdc9afd8684b
Found initrd image: /boot/initramfs-0-rescue-467ee3274b0447fe82e1fdc9afd8684b.img
Found Windows Boot Manager on /dev/sda1@/EFI/Microsoft/Boot/bootmgfw.efi
done

(14)

[root@sice ~]# sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/sysconfig/selinux


[root@sice ~]# cat /etc/sysconfig/selinux

# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of these three values:
#     targeted - Targeted processes are protected,
#     minimum - Modification of targeted policy. Only selected processes are protected.
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted


(15) 讓nfs可通過防火牆

[root@sice ~]# firewall-cmd --add-service nfs
success
[root@sice ~]# firewall-cmd --runtime-to-permanent
success
[root@sice ~]# systemctl enable nfs-server.service
Created symlink /etc/systemd/system/multi-user.target.wants/nfs-server.service → /usr/lib/systemd/system/nfs-server.service.
[root@sice ~]# systemctl start nfs-server.service

[root@sice ~]# date
日  1月 20 16:05:45 CST 2019

 

REF:https://fedoramagazine.org/how-to-build-a-netboot-server-part-1/

 

20190118製作Fedora Server’s netinst images隨身碟(一個16GB的USB隨身碟才175元)成功
2019/01/18,20:36

REF https://blog.gtwang.org/linux/linux-dd-command-write-iso-to-usb-flash-drive/

(1)下載Fedora 28 server 網路安裝映像檔

wget https://dl.fedoraproject.org/pub/fedora/linux/releases/28/Server/x86_64/iso/Fedora-Server-netinst-x86_64-28-1.1.iso

(2)用lsblk指令察看本機磁碟裝置(隨身碟要先插上,會自動掛上)

$ lsblk

NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT

sdb 8:16 0 465.8G 0 disk

├─sdb2 8:18 0 500M 0 part

├─sdb5 8:21 0 221.6G 0 part

├─sdb3 8:19 0 48.4G 0 part

│ ├─fedora-root 252:1 0 45G 0 lvm

│ └─fedora-swap 252:0 0 3.4G 0 lvm [SWAP]

└─sdb1 8:17 0 1K 0 part

sr0 11:0 1 1024M 0 rom

sdc 8:32 1 57.9G 0 disk

├─sdc2 8:34 1 1K 0 part

├─sdc5 8:37 1 3.9G 0 part [SWAP]

└─sdc1 8:33 1 54G 0 part /

sda 8:0 0 931.5G 0 disk

├─sda4 8:4 0 269.8G 0 part

├─sda2 8:2 0 17G 0 part

├─sda3 8:3 0 372.6G 0 part

└─sda1 8:1 0 100M 0 part

sdh 8:112 1 14.3G 0 disk

└─sdh1 8:113 1 14.3G 0 part /media/treehrt/12CB-CB88

 (3)卸載剛系統自動掛上的隨身碟 

$ umount /media/treehrt/12CB-CB88

$ lsblk

:

sdh 8:112 1 14.3G 0 disk

└─sdh1 8:113 1 14.3G 0 part

(4)察看下載的iso檔

$ cd /home/treehrt

$ ls *.iso

Fedora-Server-netinst-x86_64-28-1.1.iso

(5) 用dd指今將Fedora-Server-netinst-x86_64-28-1.1.iso檔展開寫入USB隨身碟(/dev/sdh)中 

$ sudo dd if=Fedora-Server-netinst-x86_64-28-1.1.iso of=/dev/sdh bs=1M

[sudo] password for treehrt:

輸入 583+0 個紀錄

輸出 583+0 個紀錄

611319808 bytes (611 MB, 583 MiB) copied, 37.7773 s, 16.2 MB/s

 

 

20190117在ubuntu1604裝nfsserver成功
2019/01/17,19:57

ref :http://flykof.pixnet.net/blog/post/23028290-ubunto%E4%B8%8B%E5%AE%89%E8%A3%9D%E8%A8%AD%E5%AE%9Anfs

 

(1)$ sudo apt-get install nfs-kernel-server

:

  keyutils libnfsidmap2 libtirpc1 nfs-common rpcbind
建議套件:
  open-iscsi watchdog
下列【新】套件將會被安裝:
  keyutils libnfsidmap2 libtirpc1 nfs-common nfs-kernel-server rpcbind
升級 0 個,新安裝 6 個,移除 0 個,有 470 個未被升級。
需要下載 484 kB 的套件檔。
此操作完成之後,會多佔用 1,828 kB 的磁碟空間。
是否繼續進行 [Y/n]? [Y/n] y

取得 484 kB 用了 2秒 (163 kB/s)          
選取了原先未選的套件 libnfsidmap2:i386。
(讀取資料庫 ... 目前共安裝了 325945 個檔案和目錄。)
準備解開 .../libnfsidmap2_0.25-5_i386.deb ...
解開 libnfsidmap2:i386 (0.25-5) 中...
選取了原先未選的套件 keyutils。
準備解開 .../keyutils_1.5.9-8ubuntu1_i386.deb ...
解開 keyutils (1.5.9-8ubuntu1) 中...
選取了原先未選的套件 libtirpc1:i386。
準備解開 .../libtirpc1_0.2.5-1ubuntu0.1_i386.deb ...
解開 libtirpc1:i386 (0.2.5-1ubuntu0.1) 中...
選取了原先未選的套件 rpcbind。
準備解開 .../rpcbind_0.2.3-0.2_i386.deb ...
解開 rpcbind (0.2.3-0.2) 中...
選取了原先未選的套件 nfs-common。
準備解開 .../nfs-common_1%3a1.2.8-9ubuntu12.1_i386.deb ...
解開 nfs-common (1:1.2.8-9ubuntu12.1) 中...
選取了原先未選的套件 nfs-kernel-server。
準備解開 .../nfs-kernel-server_1%3a1.2.8-9ubuntu12.1_i386.deb ...
解開 nfs-kernel-server (1:1.2.8-9ubuntu12.1) 中...
Processing triggers for man-db (2.7.5-1) ...
Processing triggers for libc-bin (2.23-0ubuntu10) ...
Processing triggers for systemd (229-4ubuntu21.2) ...
Processing triggers for ureadahead (0.100.0-19) ...
ureadahead will be reprofiled on next reboot
設定 libnfsidmap2:i386 (0.25-5) ...
設定 keyutils (1.5.9-8ubuntu1) ...
設定 libtirpc1:i386 (0.2.5-1ubuntu0.1) ...
設定 rpcbind (0.2.3-0.2) ...
設定 nfs-common (1:1.2.8-9ubuntu12.1) ...

Creating config file /etc/idmapd.conf with new version

Creating config file /etc/default/nfs-common with new version
增加系統使用者 `statd' (UID 122) ...
正在新增新使用者 `statd' (UID 122) 到群組 `nogroup' ...
不會建立家目錄 `/var/lib/nfs' 。
nfs-utils.service is a disabled or a static unit, not starting it.
設定 nfs-kernel-server (1:1.2.8-9ubuntu12.1) ...

Creating config file /etc/exports with new version

Creating config file /etc/default/nfs-kernel-server with new version
Processing triggers for libc-bin (2.23-0ubuntu10) ...
Processing triggers for systemd (229-4ubuntu21.2) ...
Processing triggers for ureadahead (0.100.0-19) ...

 

 

(2)$ sudo vi /etc/hosts.deny
treehrt ~$ cat /etc/hosts.deny
# /etc/hosts.deny: list of hosts that are _not_ allowed to access the system.
#                  See the manual pages hosts_access(5) and hosts_options(5).
#
# Example:    ALL: some.host.name, .some.domain
#             ALL EXCEPT in.fingerd: other.host.name, .other.domain
#
# If you're going to protect the portmapper use the name "rpcbind" for the
# daemon name. See rpcbind(8) and rpc.mountd(8) for further information.
#
# The PARANOID wildcard matches any host whose name does not match its
# address.
#
# You may wish to enable this to ensure any programs that don't
# validate looked up hostnames still leave understandable logs. In past
# versions of Debian this has been the default.
# ALL: PARANOID

portmap:ALL
lockd:ALL
mountd:ALL
rquotad:ALL
statd:ALL
treehrt ~$

(3)$ vi /etc/default/portmap

(4)$ sudo vi /etc/hosts.allow
$ cat /etc/hosts.allow
# /etc/hosts.allow: list of hosts that are allowed to access the system.
#                   See the manual pages hosts_access(5) and hosts_options(5).
#
# Example:    ALL: LOCAL @some_netgroup
#             ALL: .foobar.edu EXCEPT terminalserver.foobar.edu
#
# If you're going to protect the portmapper use the name "rpcbind" for the
# daemon name. See rpcbind(8) and rpc.mountd(8) for further information.
#
### NFS DAEMONS
portmap: 192.168.2.
lockd: 192.168.2.
rquotad: 192.168.2.
mountd: 192.168.2.
statd: 192.168.2.
treehrt ~$

(5)$ sudo vi /etc/exports
$ cat /etc/exports
# /etc/exports: the access control list for filesystems which may be exported
#        to NFS clients.  See exports(5).
#
# Example for NFSv2 and NFSv3:
# /srv/homes       hostname1(rw,sync,no_subtree_check) hostname2(ro,sync,no_subtree_check)
#
# Example for NFSv4:
# /srv/nfs4        gss/krb5i(rw,sync,fsid=0,crossmnt,no_subtree_check)
# /srv/nfs4/homes  gss/krb5i(rw,sync,no_subtree_check)
#
/home/treehrt/busyboxRoot 192.168.2.*(rw,sync,no_root_squash)

$ pwd
/home/treehrt

 

(6)$ sudo exportfs -r
exportfs: /etc/exports [1]: Neither 'subtree_check' or 'no_subtree_check' specified for export "203.68.230.*:/home/treehrt/busyboxRoot".
  Assuming default behaviour ('no_subtree_check').
  NOTE: this default has changed since nfs-utils version 1.0.x

exportfs: Failed to stat /home/treehrt/busyboxRoot: No such file or directory
treehrt ~$

(7)$ mkdir busyboxRoot

(8)$ sudo exportfs -r
exportfs: /etc/exports [1]: Neither 'subtree_check' or 'no_subtree_check' specified for export "192.168.2.*:/home/treehrt/busyboxRoot".
  Assuming default behaviour ('no_subtree_check').
  NOTE: this default has changed since nfs-utils version 1.0.x

(9)
$ sudo /etc/init.d/nfs-kernel-server restart
[ ok ] Restarting nfs-kernel-server (via systemctl): nfs-kernel-server.service.
 

(10)$ mkdir /home/treehrt/nfs
(11)$ sudo mount -t nfs 192.168.2.100:/home/treehrt/busyboxRoot /home/treehrt/nfs

(12) 將png圖檔拷到/home/treehrt/nfs中,也出現在/home/treehrt/busyboxRoot中

$ cp Firefox_wallpaper.png /home/treehrt/nfs

$ ls /home/treehrt/nfs
Firefox_wallpaper.png

$ ls /home/treehrt/busyboxRoot/ -l
總計 3664
-rw-rw-r-- 1 treehrt treehrt 3749769  1月 17 20:19 Firefox_wallpaper.png


20190117在fedora裝gcc7.4成功
2019/01/17,11:54

 

REF:https://gcc.gnu.org/install/configure.html

ref: https://gcc.gnu.org/wiki/InstallingGCC

(1)察看既有版本:

# gcc -v
使用內建 specs。
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/i686-redhat-linux/4.8.3/lto-wrapper
目的:i686-redhat-linux
配置為:../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-linker-hash-style=gnu --enable-languages=c,c++,objc,obj-c++,java,fortran,ada,go,lto --enable-plugin --enable-initfini-array --enable-java-awt=gtk --disable-dssi --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre --enable-libgcj-multifile --enable-java-maintainer-mode --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --disable-libjava-multilib --with-isl=/builddir/build/BUILD/gcc-4.8.3-20140911/obj-i686-redhat-linux/isl-install --with-cloog=/builddir/build/BUILD/gcc-4.8.3-20140911/obj-i686-redhat-linux/cloog-install --with-tune=generic --with-arch=i686 --build=i686-redhat-linux
執行緒模型:posix
gcc version 4.8.3 20140911 (Red Hat 4.8.3-7) (GCC)

(2)# uname -a
Linux localhost.localdomain 3.19.8 #1 SMP Fri Jan 8 12:41:11 CST 2016 i686 i686 i386 GNU/Linux

 

(3)自mirror站下載gcc-7.4 tarball

# wget http://ftp.tsukuba.wide.ad.jp/software/gcc/releases/gcc-7.4.0/gcc-7.4.0.tar.gz

:

2019-01-17 19:55:12 (667 KB/s) - ‘gcc-7.4.0.tar.gz’ saved [112420370/112420370]

 

(4)解開# tar xvzf gcc-7.4.0.tar.gz

 

(5)安裝說明網頁:http://gcc.gnu.org/install/


(6)# pwd
/root/gcc-7.4.0


[root@localhost gcc-7.4.0]# ./contrib/download_prerequisites
2019-01-17 23:26:23 URL: ftp://gcc.gnu.org/pub/gcc/infrastructure/gmp-6.1.0.tar.bz2 [2383840] -> "./gmp-6.1.0.tar.bz2" [1]
2019-01-17 23:26:27 URL: ftp://gcc.gnu.org/pub/gcc/infrastructure/mpfr-3.1.4.tar.bz2 [1279284] -> "./mpfr-3.1.4.tar.bz2" [1]
2019-01-17 23:26:31 URL: ftp://gcc.gnu.org/pub/gcc/infrastructure/mpc-1.0.3.tar.gz [669925] -> "./mpc-1.0.3.tar.gz" [1]
2019-01-17 23:26:36 URL: ftp://gcc.gnu.org/pub/gcc/infrastructure/isl-0.16.1.tar.bz2 [1626446] -> "./isl-0.16.1.tar.bz2" [1]
gmp-6.1.0.tar.bz2: 正確
mpfr-3.1.4.tar.bz2: 正確
mpc-1.0.3.tar.gz: 正確
isl-0.16.1.tar.bz2: 正確
All prerequisites downloaded successfully.
[root@localhost gcc-7.4.0]#

(7)

# cd ..

# mkdir gcc7obj

# cd gcc7obj/
# ../gcc-7.4.0/configure --prefix=$HOME/GCC-7.4.0 --enable-languages=c,c++,fortran,go

(8)# make

要編譯很久…

:

  done; \
fi
make[5]: Leaving directory `/root/gcc7obj/i686-pc-linux-gnu/libitm'
make[4]: Leaving directory `/root/gcc7obj/i686-pc-linux-gnu/libitm'
make[3]: Leaving directory `/root/gcc7obj/i686-pc-linux-gnu/libitm'
make[2]: Leaving directory `/root/gcc7obj/i686-pc-linux-gnu/libitm'
make[1]: Leaving directory `/root/gcc7obj'
[root@localhost gcc7obj]# date
五  1月 18 15:22:40 CST 2019

(9)# make install

 

:

ldconfig: /root/GCC-7.4.0/lib/libstdc++.so.6.0.24-gdb.py is not an ELF file - it has the wrong magic bytes at the start.

----------------------------------------------------------------------
Libraries have been installed in:
   /root/GCC-7.4.0/lib

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
   - add LIBDIR to the `LD_LIBRARY_PATH' environment variable
     during execution
   - add LIBDIR to the `LD_RUN_PATH' environment variable
     during linking
   - use the `-Wl,-rpath -Wl,LIBDIR' linker flag
   - have your system administrator add LIBDIR to `/etc/ld.so.conf'

See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------
 /usr/bin/mkdir -p '/root/GCC-7.4.0/share/info'
 /usr/bin/install -c -m 644 ../../../gcc-7.4.0/libitm/libitm.info '/root/GCC-7.4.0/share/info'
 install-info --info-dir='/root/GCC-7.4.0/share/info' '/root/GCC-7.4.0/share/info/libitm.info'
make[4]: Leaving directory `/root/gcc7obj/i686-pc-linux-gnu/libitm'
make[3]: Leaving directory `/root/gcc7obj/i686-pc-linux-gnu/libitm'
make[2]: Leaving directory `/root/gcc7obj/i686-pc-linux-gnu/libitm'
make[1]: Leaving directory `/root/gcc7obj'

(10)

[root@localhost bin]# pwd
/root/GCC-7.4.0/bin

# ls /root/GCC-7.4.0/bin -l
總計 59452
-rwxr-xr-x 4 root root 4101903  1月 18 15:24 c++
-rwxr-xr-x 1 root root 4100493  1月 18 15:24 cpp
-rwxr-xr-x 4 root root 4101903  1月 18 15:24 g++
-rwxr-xr-x 3 root root 4094153  1月 18 15:24 gcc
-rwxr-xr-x 2 root root  121120  1月 18 15:24 gcc-ar
-rwxr-xr-x 2 root root 4102952  1月 18 15:24 gccgo
-rwxr-xr-x 2 root root  121072  1月 18 15:24 gcc-nm
-rwxr-xr-x 2 root root  121084  1月 18 15:24 gcc-ranlib
-rwxr-xr-x 1 root root 3534906  1月 18 15:24 gcov
-rwxr-xr-x 1 root root 2636230  1月 18 15:24 gcov-dump
-rwxr-xr-x 1 root root 2841034  1月 18 15:24 gcov-tool
-rwxr-xr-x 2 root root 4103291  1月 18 15:24 gfortran
-rwxr-xr-x 1 root root 1584406  1月 18 15:24 go
-rwxr-xr-x 1 root root  311119  1月 18 15:24 gofmt
-rwxr-xr-x 4 root root 4101903  1月 18 15:24 i686-pc-linux-gnu-c++
-rwxr-xr-x 4 root root 4101903  1月 18 15:24 i686-pc-linux-gnu-g++
-rwxr-xr-x 3 root root 4094153  1月 18 15:24 i686-pc-linux-gnu-gcc
-rwxr-xr-x 3 root root 4094153  1月 18 15:24 i686-pc-linux-gnu-gcc-7.4.0
-rwxr-xr-x 2 root root  121120  1月 18 15:24 i686-pc-linux-gnu-gcc-ar
-rwxr-xr-x 2 root root 4102952  1月 18 15:24 i686-pc-linux-gnu-gccgo
-rwxr-xr-x 2 root root  121072  1月 18 15:24 i686-pc-linux-gnu-gcc-nm
-rwxr-xr-x 2 root root  121084  1月 18 15:24 i686-pc-linux-gnu-gcc-ranlib
-rwxr-xr-x 2 root root 4103291  1月 18 15:24 i686-pc-linux-gnu-gfortran
[root@localhost bin]#

 

# ./g++ -v
使用內建 specs。
COLLECT_GCC=./g++
COLLECT_LTO_WRAPPER=/root/GCC-7.4.0/libexec/gcc/i686-pc-linux-gnu/7.4.0/lto-wrapper
目的:i686-pc-linux-gnu
配置為:../gcc-7.4.0/configure --prefix=/root/GCC-7.4.0 --enable-languages=c,c++,fortran,go
執行緒模型:posix
gcc version 7.4.0 (GCC)

 

# ./gcc -v
使用內建 specs。
COLLECT_GCC=./gcc
COLLECT_LTO_WRAPPER=/root/GCC-7.4.0/libexec/gcc/i686-pc-linux-gnu/7.4.0/lto-wrapper
目的:i686-pc-linux-gnu
配置為:../gcc-7.4.0/configure --prefix=/root/GCC-7.4.0 --enable-languages=c,c++,fortran,go
執行緒模型:posix
gcc version 7.4.0 (GCC)

 

(12)

# pwd
/root/GCC-7.4.0/bin

# cp gcc /usr/bin/gcc7

# cp g++ /usr/bin/g++7

(13)

# GCC-7.4.0/bin/gcc -c t1.c

t1.c: In function 「main」:
t1.c:3:2: 警告:隱含宣告函式 「printf」 [-Wimplicit-function-declaration]
  printf("早安\n";
  ^~~~~~
t1.c:3:2: 警告:隱含宣告與內建函式 「printf」 不相容
t1.c:3:2: 附註:include 「<stdio.h>」 or provide a declaration of 「printf」
t1.c:3:19: 錯誤:expected 「)」 before 「;」 token
  printf("早安\n";
                   ^
t1.c:4:1: 錯誤:expected 「;」 before 「}」 token
 }

 

(14)# cat t1.c

 
#include <stdio.h>
void main()
{
        printf("早安\n");
}

(15)

# GCC-7.4.0/bin/gcc t1.c -o t1

# ./t1
早安

20190116在ubuntu 1604裝gcc7及gcc8成功
2019/01/16,19:33

REF:https://gist.github.com/jlblancoc/99521194aba975286c80f93e47966dc5

(1)$ sudo add-apt-repository ppa:ubuntu-toolchain-r/test

[sudo] password for treehrt:

Toolchain test builds; see https://wiki.ubuntu.com/ToolChain

 

更多資訊:https://launchpad.net/~ubuntu-toolchain-r/+archive/ubuntu/test

請輸入 [ENTER] 繼續,或 Ctrl-C 來取消加入動作

 

gpg: `/tmp/tmp7q8_no83/secring.gpg' 鑰匙圈已建立

gpg: `/tmp/tmp7q8_no83/pubring.gpg' 鑰匙圈已建立

gpg: 正在請求金鑰 BA9EF27F hkp 伺服器 keyserver.ubuntu.com

gpg: /tmp/tmp7q8_no83/trustdb.gpg: 建立了信任資料庫

gpg: 金鑰 BA9EF27F: 公鑰 "Launchpad Toolchain builds" 已匯入

gpg: 處理總量: 1

gpg: 已匯入: 1 (RSA: 1)

OK

 

(2)$ sudo apt update

略過:1 http://dl.google.com/linux/earth/deb stable InRelease

已有:2 http://dl.google.com/linux/earth/deb stable Release

下載:3 http://dl.google.com/linux/earth/deb stable Release.gpg [819 B]

略過:3 http://dl.google.com/linux/earth/deb stable Release.gpg

已有:4 http://tw.archive.ubuntu.com/ubuntu xenial InRelease

下載:5 http://tw.archive.ubuntu.com/ubuntu xenial-updates InRelease [109 kB]

下載:6 http://security.ubuntu.com/ubuntu xenial-security InRelease [107 kB]

下載:7 http://tw.archive.ubuntu.com/ubuntu xenial-backports InRelease [107 kB]

下載:8 http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu xenial InRelease [17.5 kB]

下載:9 http://tw.archive.ubuntu.com/ubuntu xenial-updates/main i386 DEP-11 Metadata [320 kB]

下載:10 http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu xenial/main i386 Packages [78.6 kB]

下載:11 http://tw.archive.ubuntu.com/ubuntu xenial-updates/main DEP-11 64x64 Icons [227 kB]

下載:12 http://tw.archive.ubuntu.com/ubuntu xenial-updates/universe i386 DEP-11 Metadata [251 kB]

下載:13 http://tw.archive.ubuntu.com/ubuntu xenial-updates/universe DEP-11 64x64 Icons [341 kB]

下載:14 http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu xenial/main Translation-en [14.8 kB]

下載:15 http://tw.archive.ubuntu.com/ubuntu xenial-updates/multiverse i386 DEP-11 Metadata [7,152 B]

下載:16 http://tw.archive.ubuntu.com/ubuntu xenial-updates/multiverse DEP-11 64x64 Icons [14.3 kB]

下載:17 http://tw.archive.ubuntu.com/ubuntu xenial-backports/main i386 DEP-11 Metadata [3,328 B]

下載:18 http://tw.archive.ubuntu.com/ubuntu xenial-backports/universe i386 DEP-11 Metadata [5,104 B]

正在讀取套件清單... 完成

W: GPG 錯誤: http://dl.google.com/linux/earth/deb stable Release: 由於無法取得它們的公鑰,以下簽章無法進行驗證: NO_PUBKEY 1397BC53640DB551

E: The repository 'http://dl.google.com/linux/earth/deb stable Release' is not signed.

N: Updating from such a repository can't be done securely, and is therefore disabled by default.

N: See apt-secure(8) manpage for repository creation and user configuration details.

treehrt ~$

(3) $ sudo apt install g++-7 -y

:


準備解開 .../g++-7_7.4.0-1ubuntu1~16.04~ppa1_i386.deb ...

解開 g++-7 (7.4.0-1ubuntu1~16.04~ppa1) ...

Processing triggers for man-db (2.7.5-1) ...

Processing triggers for libc-bin (2.23-0ubuntu10) ...

設定 gcc-7-base:i386 (7.4.0-1ubuntu1~16.04~ppa1) ...

設定 cpp-7 (7.4.0-1ubuntu1~16.04~ppa1) ...

設定 libcc1-0:i386 (8.1.0-5ubuntu1~16.04) ...

設定 libgomp1:i386 (8.1.0-5ubuntu1~16.04) ...

設定 libitm1:i386 (8.1.0-5ubuntu1~16.04) ...

設定 libatomic1:i386 (8.1.0-5ubuntu1~16.04) ...

設定 libasan4:i386 (7.4.0-1ubuntu1~16.04~ppa1) ...

設定 libubsan0:i386 (7.4.0-1ubuntu1~16.04~ppa1) ...

設定 libcilkrts5:i386 (7.4.0-1ubuntu1~16.04~ppa1) ...

設定 libmpx2:i386 (8.1.0-5ubuntu1~16.04) ...

設定 libquadmath0:i386 (8.1.0-5ubuntu1~16.04) ...

設定 libgcc-7-dev:i386 (7.4.0-1ubuntu1~16.04~ppa1) ...

設定 gcc-7 (7.4.0-1ubuntu1~16.04~ppa1) ...

設定 libstdc++-7-dev:i386 (7.4.0-1ubuntu1~16.04~ppa1) ...

設定 g++-7 (7.4.0-1ubuntu1~16.04~ppa1) ...

Processing triggers for libc-bin (2.23-0ubuntu10) ...

 

(4)$ gcc-7 -v

Using built-in specs.
COLLECT_GCC=gcc-7
COLLECT_LTO_WRAPPER=/usr/lib/gcc/i686-linux-gnu/7/lto-wrapper
Target: i686-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 7.4.0-1ubuntu1~16.04~ppa1' --with-bugurl=file:///usr/share/doc/gcc-7/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++ --prefix=/usr --with-gcc-major-version-only --program-suffix=-7 --program-prefix=i686-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --with-system-zlib --with-target-system-zlib --enable-objc-gc=auto --enable-targets=all --enable-multiarch --disable-werror --with-arch-32=i686 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-checking=release --build=i686-linux-gnu --host=i686-linux-gnu --target=i686-linux-gnu
Thread model: posix
gcc version 7.4.0 (Ubuntu 7.4.0-1ubuntu1~16.04~ppa1)

 

 

(5)$ g++-7 -v
Using built-in specs.
COLLECT_GCC=g++-7
COLLECT_LTO_WRAPPER=/usr/lib/gcc/i686-linux-gnu/7/lto-wrapper
Target: i686-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 7.4.0-1ubuntu1~16.04~ppa1' --with-bugurl=file:///usr/share/doc/gcc-7/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++ --prefix=/usr --with-gcc-major-version-only --program-suffix=-7 --program-prefix=i686-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --with-system-zlib --with-target-system-zlib --enable-objc-gc=auto --enable-targets=all --enable-multiarch --disable-werror --with-arch-32=i686 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-checking=release --build=i686-linux-gnu --host=i686-linux-gnu --target=i686-linux-gnu
Thread model: posix
gcc version 7.4.0 (Ubuntu 7.4.0-1ubuntu1~16.04~ppa1)
treehrt ~/gtk$

 

(6) $ g++-7 mapgpx.c -Wall `pkg-config --cflags --libs gtk+-3.0` -export-dynamic -lm -o mapgpx2

mapgpx.c: In function ‘void load_gpxB(char*, gpxR*)’:

mapgpx.c:316:6: warning: ‘%s’ directive writing up to 79 bytes into a region of size between 19 and 177 [-Wformat-overflow=]

void load_gpxB(char fname[100],gpxR *gp) {

^~~~~~~~~

mapgpx.c:524:16: note: ‘sprintf’ output between 12 and 1176 bytes into a destination of size 180

sprintf(sbind,"%s %s p%s(%.0f %.0f) %.0fm",

~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

gp->pW[i].date,gp->pW[i].time,gp->pW[i].name,

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

gp->pW[i].x67,gp->pW[i].y67,gp->pW[i].high);

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

在舊版gcc沒有以上警告。


(7)用g++-7新編繹的執行檔mapgpx2可順利執行

 

(8)舊版gcc

treehrt ~/gtk$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/i686-linux-gnu/5/lto-wrapper
Target: i686-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 5.4.0-6ubuntu1~16.04.9' --with-bugurl=file:///usr/share/doc/gcc-5/README.Bugs --enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-5 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-5-i386/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-5-i386 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-5-i386 --with-arch-directory=i386 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-targets=all --enable-multiarch --disable-werror --with-arch-32=i686 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-checking=release --build=i686-linux-gnu --host=i686-linux-gnu --target=i686-linux-gnu
Thread model: posix
gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.9)

(9)舊版g++

treehrt ~/gtk$ g++ -v
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/i686-linux-gnu/5/lto-wrapper
Target: i686-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 5.4.0-6ubuntu1~16.04.9' --with-bugurl=file:///usr/share/doc/gcc-5/README.Bugs --enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-5 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-5-i386/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-5-i386 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-5-i386 --with-arch-directory=i386 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-targets=all --enable-multiarch --disable-werror --with-arch-32=i686 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-checking=release --build=i686-linux-gnu --host=i686-linux-gnu --target=i686-linux-gnu
Thread model: posix
gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.9)

(10)$ sudo apt-get install gcc-8 g++-8
:下列的額外套件將被安裝:
  cpp-8 libasan5 libgcc-8-dev libstdc++-8-dev libubsan1
建議套件:
  gcc-8-locales g++-8-multilib gcc-8-doc libstdc++6-8-dbg gcc-8-multilib libgcc1-dbg libgomp1-dbg libitm1-dbg libatomic1-dbg libasan5-dbg liblsan0-dbg libtsan0-dbg libubsan1-dbg libmpx2-dbg
  libquadmath0-dbg libstdc++-8-doc
下列【新】套件將會被安裝:
  cpp-8 g++-8 gcc-8 libasan5 libgcc-8-dev libstdc++-8-dev libubsan1
升級 0 個,新安裝 7 個,移除 0 個,有 470 個未被升級。
需要下載 28.4 MB 的套件檔。
此操作完成之後,會多佔用 111 MB 的磁碟空間。
是否繼續進行 [Y/n]? [Y/n] y
:

設定 cpp-8 (8.1.0-5ubuntu1~16.04) ...
設定 libasan5:i386 (8.1.0-5ubuntu1~16.04) ...
設定 libubsan1:i386 (8.1.0-5ubuntu1~16.04) ...
設定 libgcc-8-dev:i386 (8.1.0-5ubuntu1~16.04) ...
設定 gcc-8 (8.1.0-5ubuntu1~16.04) ...
設定 libstdc++-8-dev:i386 (8.1.0-5ubuntu1~16.04) ...
設定 g++-8 (8.1.0-5ubuntu1~16.04) ...
Processing triggers for libc-bin (2.23-0ubuntu10) ...

(11)$ g++-8 -v
Using built-in specs.
COLLECT_GCC=g++-8
COLLECT_LTO_WRAPPER=/usr/lib/gcc/i686-linux-gnu/8/lto-wrapper
Target: i686-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 8.1.0-5ubuntu1~16.04' --with-bugurl=file:///usr/share/doc/gcc-8/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++ --prefix=/usr --with-gcc-major-version-only --program-suffix=-8 --program-prefix=i686-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --with-system-zlib --with-target-system-zlib --enable-objc-gc=auto --enable-targets=all --enable-multiarch --disable-werror --with-arch-32=i686 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-checking=release --build=i686-linux-gnu --host=i686-linux-gnu --target=i686-linux-gnu
Thread model: posix
gcc version 8.1.0 (Ubuntu 8.1.0-5ubuntu1~16.04)

(12)$ gcc-8 -v
Using built-in specs.
COLLECT_GCC=gcc-8
COLLECT_LTO_WRAPPER=/usr/lib/gcc/i686-linux-gnu/8/lto-wrapper
Target: i686-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 8.1.0-5ubuntu1~16.04' --with-bugurl=file:///usr/share/doc/gcc-8/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++ --prefix=/usr --with-gcc-major-version-only --program-suffix=-8 --program-prefix=i686-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --with-system-zlib --with-target-system-zlib --enable-objc-gc=auto --enable-targets=all --enable-multiarch --disable-werror --with-arch-32=i686 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-checking=release --build=i686-linux-gnu --host=i686-linux-gnu --target=i686-linux-gnu
Thread model: posix
gcc version 8.1.0 (Ubuntu 8.1.0-5ubuntu1~16.04)
treehrt ~/gtk$

(13)$ g++-8 mapgpx.c -Wall `pkg-config --cflags --libs gtk+-3.0` -export-dynamic -lm -o mapgpx3
In file included from /usr/include/gtk-3.0/gtk/gtk.h:98,
                 from mapgpx.c:18:
/usr/include/gtk-3.0/gtk/gtkfilechooserbutton.h:66:8: warning: unnecessary parentheses in declaration of ‘__gtk_reserved1’ [-Wparentheses]
   void (*__gtk_reserved1);
        ^
/usr/include/gtk-3.0/gtk/gtkfilechooserbutton.h:67:8: warning: unnecessary parentheses in declaration of ‘__gtk_reserved2’ [-Wparentheses]
   void (*__gtk_reserved2);
        ^
/usr/include/gtk-3.0/gtk/gtkfilechooserbutton.h:68:8: warning: unnecessary parentheses in declaration of ‘__gtk_reserved3’ [-Wparentheses]
   void (*__gtk_reserved3);
        ^
/usr/include/gtk-3.0/gtk/gtkfilechooserbutton.h:69:8: warning: unnecessary parentheses in declaration of ‘__gtk_reserved4’ [-Wparentheses]
   void (*__gtk_reserved4);
        ^
In file included from /usr/include/gtk-3.0/gtk/gtk.h:261,
                 from mapgpx.c:18:
/usr/include/gtk-3.0/gtk/deprecated/gtkstatusicon.h:74:8: warning: unnecessary parentheses in declaration of ‘__gtk_reserved1’ [-Wparentheses]
   void (*__gtk_reserved1);
        ^
/usr/include/gtk-3.0/gtk/deprecated/gtkstatusicon.h:75:8: warning: unnecessary parentheses in declaration of ‘__gtk_reserved2’ [-Wparentheses]
   void (*__gtk_reserved2);
        ^
/usr/include/gtk-3.0/gtk/deprecated/gtkstatusicon.h:76:8: warning: unnecessary parentheses in declaration of ‘__gtk_reserved3’ [-Wparentheses]
   void (*__gtk_reserved3);
        ^
/usr/include/gtk-3.0/gtk/deprecated/gtkstatusicon.h:77:8: warning: unnecessary parentheses in declaration of ‘__gtk_reserved4’ [-Wparentheses]
   void (*__gtk_reserved4);
        ^
mapgpx.c: In function ‘void load_gpxB(char*, gpxR*)’:
mapgpx.c:524:23: warning: ‘%s’ directive writing up to 79 bytes into a region of size between 19 and 177 [-Wformat-overflow=]
         sprintf(sbind,"%s %s p%s(%.0f %.0f) %.0fm",
                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
mapgpx.c:524:16: note: ‘sprintf’ output between 12 and 1176 bytes into a destination of size 180
         sprintf(sbind,"%s %s p%s(%.0f %.0f) %.0fm",
         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                         gp->pW[i].date,gp->pW[i].time,gp->pW[i].name,
                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                         gp->pW[i].x67,gp->pW[i].y67,gp->pW[i].high);
                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
mapgpx.c: In function ‘int save_wptgpx(gpxR*, P2D*, char (*)[80], int)’:
mapgpx.c:1099:13: warning: ‘%s’ directive writing up to 79 bytes into a region of size between 27 and 86 [-Wformat-overflow=]
  sprintf(fn,"out%s_%s.gpx",q,sthm);
             ^~~~~~~~~~~~~~   ~~~~
mapgpx.c:1099:9: note: ‘sprintf’ output between 9 and 147 bytes into a destination of size 90
  sprintf(fn,"out%s_%s.gpx",q,sthm);
  ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
mapgpx.c: In function ‘int save_gpx2(gpxR*, gpxR*)’:
mapgpx.c:1167:13: warning: ‘%s’ directive writing up to 79 bytes into a region of size between 27 and 86 [-Wformat-overflow=]
  sprintf(fn,"out%s_%s.gpx",q,sthm);
             ^~~~~~~~~~~~~~   ~~~~
mapgpx.c:1167:9: note: ‘sprintf’ output between 9 and 147 bytes into a destination of size 90
  sprintf(fn,"out%s_%s.gpx",q,sthm);
  ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
mapgpx.c: In function ‘int save_gpx()’:
mapgpx.c:1295:13: warning: ‘%s’ directive writing up to 79 bytes into a region of size between 27 and 86 [-Wformat-overflow=]
  sprintf(fn,"out%s_%s.jpg",q,sthm);
             ^~~~~~~~~~~~~~   ~~~~
mapgpx.c:1295:9: note: ‘sprintf’ output between 9 and 147 bytes into a destination of size 90
  sprintf(fn,"out%s_%s.jpg",q,sthm);
  ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~

(14)用g++-8 新編繹的執行檔mapgpx3可順利執行

20190116更新Fedora22(w3)的Linux核心(因採non-retpoline compiler未成)
2019/01/16,07:47

(1)機器現況

# uname -a
Linux w3-kmvs-km-edu-tw 4.4.14-200.fc22.x86_64 #1 SMP Fri Jun 24 21:19:33 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

 

(2)下載核心壓縮檔:

wget https://mirrors.edge.kernel.org/pub/linux/kernel/v4.x/linux-4.20.tar.gz

:

2019-01-16 07:53:04 (784 KB/s) - ‘linux-4.20.tar.gz’ saved [161141903/161141903]

(3)解開核心# tar xvzf linux-4.20.tar.gz

(4)用現有的組態為預設值建立核心組態

# uname -r
4.4.14-200.fc22.x86_64

# cp /boot/config-4.4.14-200.fc22.x86_64 /root/inux-4.20

(5) # make menuconfig

  HOSTCC  scripts/basic/fixdep
  UPD     scripts/kconfig/.mconf-cfg
  HOSTCC  scripts/kconfig/mconf.o
  YACC    scripts/kconfig/zconf.tab.c
/bin/sh: bison:命令找不到
scripts/Makefile.lib:196: recipe for target 'scripts/kconfig/zconf.tab.c' failed
make[1]: *** [scripts/kconfig/zconf.tab.c] Error 127
Makefile:544: recipe for target 'menuconfig' failed
make: *** [menuconfig] Error 2

(6)# yum install bison

(6b)# make menuconfig
  YACC    scripts/kconfig/zconf.tab.c
  LEX     scripts/kconfig/zconf.lex.c
/bin/sh: flex:命令找不到
scripts/Makefile.lib:188: recipe for target 'scripts/kconfig/zconf.lex.c' failed
make[1]: *** [scripts/kconfig/zconf.lex.c] Error 127
Makefile:544: recipe for target 'menuconfig' failed
make: *** [menuconfig] Error 2

(6c)# yum install flex

(6d)# make menuconfig 終於成功

 

(7)# make

You are building kernel with non-retpoline compiler.
Please update your compiler.
arch/x86/Makefile:302: recipe for target 'checkbin' failed
make: *** [checkbin] Error 1
[root@w3-kmvs-km-edu-tw linux-4.20]#

 

仍未成功

(8)#wget http://ftp.tsukuba.wide.ad.jp/software/gcc/releases/gcc-7.4.0/gcc-7.4.0.tar.gz

:

2019-01-18 10:35:46 (635 KB/s) - ‘gcc-7.4.0.tar.gz’ saved [112420370/112420370]

(9)解開

# tar xvzf gcc-7.4.0.tar.gz

#cd /root/gcc-7.4.0

 

(10)安裝說明網頁:http://gcc.gnu.org/install/

(11)下載支援的程式庫並建立符號連結以支持建立GCC

# ./contrib/download_prerequisites

:

gmp-6.1.0.tar.bz2: 正確
mpfr-3.1.4.tar.bz2: 正確
mpc-1.0.3.tar.gz: 正確
isl-0.16.1.tar.bz2: 正確
All prerequisites downloaded successfully.

(12)建立組態失敗:

# cd ..

# mkdir gcc7obj

# cd gcc7obj

#  ../gcc-7.4.0/configure --prefix=$HOME/GCC-7.4.0 --enable-languages=c,c++,fortran,go

:

configure: WARNING: using in-tree isl, disabling version check
*** This configuration is not supported in the following subdirectories:
     gnattools target-libada target-libhsail-rt target-libobjc target-liboffload                                              mic
    (Any other directories should still work fine.)
checking for default BUILD_CONFIG... bootstrap-debug
checking for --enable-vtable-verify... no
/usr/bin/ld: cannot find crt1.o: No such file or directory
/usr/bin/ld: cannot find crti.o: No such file or directory
/usr/bin/ld: cannot find -lc
/usr/bin/ld: cannot find crtn.o: No such file or directory
collect2: error: ld returned 1 exit status
configure: error: I suspect your system does not have 32-bit development libraries (libc and headers). If you have them, rerun configure with --enable-multilib.

If you do not have them, and want to build a 64-bit-only compiler, rerun configure with --disable-multilib.

(12b)重組態ok:

#  ../gcc-7.4.0/configure --prefix=$HOME/GCC-7.4.0 --enable-languages=c,c++,fortran,go --disable-multilib

:


configure: creating ./config.status
config.status: creating Makefile

(13) # make

要編譯很久…

(14)

]# ls gcc7obj -lt
總計 1436
drwxr-xr-x 17 root root    4096  1月 18 14:26 x86_64-pc-linux-gnu
drwxr-xr-x  3 root root    4096  1月 18 14:21 gotools
drwxr-xr-x  4 root root    4096  1月 18 14:16 libcc1
drwxr-xr-x  2 root root    4096  1月 18 14:16 fixincludes
-rw-r--r--  1 root root       7  1月 18 14:16 stage_current
-rw-r--r--  1 root root       7  1月 18 14:16 stage_last
-rw-r--r--  1 root root      10  1月 18 14:16 compare
drwxr-xr-x  2 root root    4096  1月 18 14:16 prev-zlib
drwxr-xr-x  2 root root    4096  1月 18 14:16 zlib
drwxr-xr-x  4 root root    4096  1月 18 14:16 libiberty
drwxr-xr-x  4 root root    4096  1月 18 14:16 prev-libiberty
drwxr-xr-x  2 root root    4096  1月 18 14:16 libdecnumber
drwxr-xr-x  2 root root    4096  1月 18 14:16 prev-libdecnumber
drwxr-xr-x  3 root root    4096  1月 18 14:16 libcpp
drwxr-xr-x  3 root root    4096  1月 18 14:16 prev-libcpp
drwxr-xr-x  3 root root    4096  1月 18 14:16 libbacktrace
drwxr-xr-x  3 root root    4096  1月 18 14:16 prev-libbacktrace
drwxr-xr-x  7 root root   12288  1月 18 14:16 isl
drwxr-xr-x  7 root root   12288  1月 18 14:16 prev-isl
drwxr-xr-x 15 root root    4096  1月 18 14:16 gmp
drwxr-xr-x 15 root root    4096  1月 18 14:16 prev-gmp
drwxr-xr-x 19 root root   32768  1月 18 14:16 gcc
drwxr-xr-x 19 root root   32768  1月 18 14:16 prev-gcc
drwxr-xr-x  3 root root    4096  1月 18 14:00 lto-plugin
drwxr-xr-x  5 root root    4096  1月 18 13:59 mpc
drwxr-xr-x  6 root root    4096  1月 18 13:58 mpfr
drwxr-xr-x  2 root root    4096  1月 18 13:57 intl
drwxr-xr-x  5 root root    4096  1月 18 13:56 prev-x86_64-pc-linux-gnu
drwxr-xr-x  3 root root    4096  1月 18 12:47 prev-lto-plugin
drwxr-xr-x  5 root root    4096  1月 18 12:42 prev-mpc
drwxr-xr-x  6 root root    4096  1月 18 12:40 prev-mpfr
drwxr-xr-x  2 root root    4096  1月 18 12:38 prev-intl
drwxr-xr-x  2 root root    4096  1月 18 12:38 prev-fixincludes
drwxr-xr-x  5 root root    4096  1月 18 12:30 stage1-x86_64-pc-linux-gnu
drwxr-xr-x 19 root root   32768  1月 18 12:30 stage1-gcc
drwxr-xr-x  2 root root    4096  1月 18 12:22 stage1-libdecnumber
drwxr-xr-x  3 root root    4096  1月 18 12:22 stage1-libcpp
drwxr-xr-x  3 root root    4096  1月 18 12:22 stage1-libbacktrace
drwxr-xr-x  2 root root    4096  1月 18 12:22 stage1-zlib
drwxr-xr-x  5 root root    4096  1月 18 12:21 build-x86_64-pc-linux-gnu
drwxr-xr-x  3 root root    4096  1月 18 12:21 stage1-lto-plugin
drwxr-xr-x  4 root root    4096  1月 18 12:21 stage1-libiberty
drwxr-xr-x  7 root root   12288  1月 18 12:21 stage1-isl
drwxr-xr-x  5 root root    4096  1月 18 12:20 stage1-mpc
drwxr-xr-x  6 root root    4096  1月 18 12:20 stage1-mpfr
drwxr-xr-x 15 root root    4096  1月 18 12:20 stage1-gmp
drwxr-xr-x  2 root root    4096  1月 18 12:19 stage1-intl
drwxr-xr-x  2 root root    4096  1月 18 12:19 stage1-fixincludes
-rw-r--r--  1 root root       7  1月 18 12:19 stage_final
-rw-r--r--  1 root root   26811  1月 18 12:17 config.log
-rw-r--r--  1 root root 1077363  1月 18 12:17 Makefile
-rwxr-xr-x  1 root root   35455  1月 18 12:17 config.status
-rw-r--r--  1 root root      13  1月 18 12:17 serdep.tmp
[root@w3-kmvs-km-edu-tw ~]#


20190115自selldb資料庫的custs資料表選擇要刪除的資料錄來刪除的PHP程式(a4.php)
2019/01/15,14:15

(1)code

<body bgcolor=green>

<?php

function exeSQL($con,$sql){   

if( $query= mysqli_query($con, $sql) ) {echo " $sql 成功!<br> "; }    

else { echo " $sql Failure!<br> "; }     return $query;

}


function dumpTableForDel($table,$con,$bgcolor){

    $sql= "select * from $table";

    $query=exeSQL($con,$sql);
    echo "<table bgcolor=$bgcolor border=7>";

    echo "<tr bgcolor=cyan>";

    $fc= mysqli_num_fields($query) ;

    while ($field = mysqli_fetch_field($query)){

        printf("<td bgcolor=pink>%s", $field->name);   

        }

    echo "<td>DEL";

    $rowc=0;

    while ($row = mysqli_fetch_array($query)){

        echo "<tr bgcolor=purple>";

        for ($i=0;$i<$fc;$i++){

            echo  "<td bgcolor=gray>" . $row[$i];

        }

echo "<td><a href=a4.php?id=" . $row[0] .">DEL</a>";

        $rowc++;   

}   

echo "</table>";

echo "資料表 $table 共計有 $rowc 筆資料。<br><br>";

}
$con = mysqli_connect('127.0.0.1', 'root', 'w??????', 'selldb');

if (!$con) { echo "Error"; exit(); }

dumpTableForDel("custs",$con,"yellow");
mysqli_close ($con);

?>

</body>

(2)mid result(http://localhost/a4.php)

select * from custs 成功!

id name amount tel DEL
10001 小草8888 1000 08-233375 DEL
10002 天牛 3000 03-933375 DEL
20002 天牛 3000 03-933375 DEL
30002 天牛777 3000 03-933375 DEL

資料表 custs 共計有 4 筆資料。

(3)final result(http://localhost/a4.php?id=10001)

select * from custs 成功!

id name amount tel DEL
10001 小草8888 1000 08-233375 DEL
10002 天牛 3000 03-933375 DEL
20002 天牛 3000 03-933375 DEL
30002 天牛777 3000 03-933375 DEL

資料表 custs 共計有 4 筆資料。

delete from custs where id=10001 OK!
刪掉 id=10001 的資料錄後,custs資料表內容如下
select * from custs 成功!

id name amount tel DEL
10002 天牛 3000 03-933375 DEL
20002 天牛 3000 03-933375 DEL
30002 天牛777 3000 03-933375 DEL

資料表 custs 共計有 3 筆資料。

 

20190114列出selldb資料庫的cust資料表的所有資料錄並編修選定的資料錄(a5.php)
2019/01/14,16:08

(1) code

<body bgcolor=lightgreen>

<?php
function executeSQL($con,$sql){   

if( $query= mysqli_query($con, $sql) ){ echo " [$sql] 成功!<br> "; }    

else { echo " [$sql] 失敗!<br> "; }    return $query;

}
function dumpRecordSetForEdit($sql,$con,$bgcolor){   

$query=executeSQL($con,$sql);   

echo "<table bgcolor=$bgcolor border=10>";   

echo "<tr bgcolor=yellow>";   

$fc= mysqli_num_fields($query) ;   

while ($field = mysqli_fetch_field($query)){

printf("<td>%s", $field->name);

}   

echo "<td bgcolor=cyan>EDIT";   

$rowc=0;   

while ($row = mysqli_fetch_array($query)){

        echo "<tr>";

        for ($i=0;$i<$fc;$i++){

            echo  "<td>" . $row[$i];

        }

        echo "<td bgcolor=white><a href='a5.php?id=" . $row[0] . "'>Edit</a>";

        $rowc++;    }

    echo "</table>";

    echo "<font color=red>共計有 $rowc 筆資料。<br><hr color=red></font>";

}

$con = @mysqli_connect('localhost', 'root', 'w????????????', 'selldb');

if (!$con) { echo "Error: " . mysqli_connect_error(); exit(); }

$sql = 'set names utf8';

$query=executeSQL($con,$sql);

$sql= "select id,name,amount,tel from custs";

dumpRecordSetForEdit($sql,$con,"orange");

$id=$_GET['id'];$uname="mo";

if ($id<>NULL){

    $sql="select id,name,amount,tel from custs where id='$id'";

    echo "待修的資料錄(id=$id)如下<br>"; 

   dumpRecordSetForEdit($sql,$con,"green");

    $query=executeSQL($con,$sql);

    $row = mysqli_fetch_array($query);

    $uname=$row[1]; $uamount=$row[2]; $utel=$row[3];

     echo "請修改下列待修資料並按確定來寫入編修:";

    echo "<form>";

    echo "id <input type=text name=uid size=4 value=$id>";

    echo "name <input type=text name=uname size=8 value=$uname >";

    echo "amount <input type=text size=6 name=uamount value=$uamount>";

    echo "tel <input type=text size=9 name=utel value=$utel>";

    echo  "<input type=submit value=Submit>";

    echo "</form><hr>";

}

$uid=$_GET['uid']; $uname=$_GET['uname'];

$uamount=$_GET['uamount']; $utel=$_GET['utel'];

if ($uname<>NULL){

    $sql= "update custs set name='$uname' ,amount=$uamount ,tel='$utel' where id='$uid'";

    $query=executeSQL($con,$sql);

}

mysqli_close ($con);

?>

</body>

(2) middle

[set names utf8] 成功!
[select id,name,amount,tel from custs] 成功!

id name amount tel EDIT
10001 小草 1000 08-233375 Edit
10002 天牛 3000 03-933375 Edit
20002 天牛 3000 03-933375 Edit
30002 天牛777 3000 03-933375 Edit

共計有 4 筆資料。


待修的資料錄(id=10001)如下
[select id,name,amount,tel from custs where id='10001'] 成功!

 

id name amount tel EDIT
10001 小草 1000 08-233375 Edit

共計有 1 筆資料。


[select id,name,amount,tel from custs where id='10001'] 成功!
請修改下列待修資料並按確定來寫入編修:

id name amount tel 
(3)final result

[set names utf8] 成功!

[select id,name,amount,tel from custs] 成功!

id name amount tel EDIT
10001 小草 1000 08-233375 Edit
10002 天牛 3000 03-933375 Edit
20002 天牛 3000 03-933375 Edit
30002 天牛777 3000 03-933375 Edit

共計有 4 筆資料。


[update custs set name='小草8888' ,amount=1000 ,tel='08-233375' where id='10001'] 成功!

20190112將Ubuntu1604的64位元Linux核心由4.13.0-45更新成linux-4.20.0成功
2019/01/12,22:46

REF:https://newtoypia.blogspot.com/2013/12/gnupg-pgp.html

(0)現況

$ uname -a
Linux treehrt-fire 4.13.0-45-generic #50~16.04.1-Ubuntu SMP Wed May 30 11:18:27 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
[treehrt ~]$ date
六  1月 12 22:45:45 CST 2019

(1)取得最新版核心:

$ wget https://cdn.kernel.org/pub/linux/kernel/v4.x/linux-4.20.tar.xz

 

2019-01-12 22:49:14 (1.87 MB/s) - ‘linux-4.20.tar.xz’ saved [104257836/104257836]

[treehrt ~]$

(2)linux-4.20.tar.xz解壓為linux-4.20.tar

[treehrt ~]$ xz -d -v linux-4.20.tar.xz
linux-4.20.tar.xz (1/1)
  100 %        99.4 MiB / 815.2 MiB = 0.122   133 MiB/s       0:06            

(3)$ wget https://cdn.kernel.org/pub/linux/kernel/v4.x/linux-4.20.tar.sign

(4)$ gpg --verify linux-4.20.tar.sign
gpg: `/home/treehrt/.gnupg/pubring.gpg' 鑰匙圈已建立
gpg: 假設被簽署的資料在 `linux-4.20.tar'
gpg: 由 2018年12月24日 (週一) 15時46分48秒 CST 建立的簽章, 使用 RSA 金鑰 ID 6092693E
gpg: 無法檢查簽章: 找不到公鑰
[treehrt ~]$

(5) $gpg --keyserver keyserver.ubuntu.com  --recv-keys 6092693E

gpg: `/home/treehrt/.gnupg/secring.gpg' 鑰匙圈已建立

gpg: 正在請求金鑰 6092693E 自 hkp 伺服器 keyserver.ubuntu.com
gpg: /home/treehrt/.gnupg/trustdb.gpg: 建立了信任資料庫
gpg: 金鑰 6092693E: 公鑰 "Greg Kroah-Hartman <gregkh@linuxfoundation.org>" 已匯入
gpg: 金鑰 6092693E: 公鑰 "Greg Kroah-Hartman (Linux kernel stable release signing key) <greg@kroah.com>" 已匯入
gpg: 金鑰 6092693E: 公鑰 "Totally Legit Signing Key <mallory@example.org>" 已匯入
gpg: 沒有找到任何徹底信任的金鑰
gpg: 處理總量: 3
gpg:               已匯入: 3  (RSA: 3)

(6)$ gpg --verify linux-4.20.tar.sign

 gpg: 假設被簽署的資料在 `linux-4.20.tar'
gpg: 由 2018年12月24日 (週一) 15時46分48秒 CST 建立的簽章, 使用 RSA 金鑰 ID 6092693E
gpg: 完好的簽章來自於 "Greg Kroah-Hartman <gregkh@linuxfoundation.org>"
gpg:                 亦即 "Greg Kroah-Hartman <gregkh@kernel.org>"
gpg:                 亦即 "Greg Kroah-Hartman (Linux kernel stable release signing key) <greg@kroah.com>"
gpg: 警告: 這把金鑰並非以受信任的簽章所認證!
gpg:          沒有證據指出這個簽章屬於這個持有者.
主鑰指紋: 647F 2865 4894 E3BD 4571  99BE 38DB BDC8 6092 693E

(7)$ tar xvf linux-4.20.tar

(8)拷用現有的組態為預設值建立核心組態

$ uname -r
4.13.0-45-generic

$ ls /boot/config-$(uname -r) -l
-rw-r--r-- 1 root root 213220  5月 31  2018 /boot/config-4.13.0-45-generic

$ cp -v /boot/config-$(uname -r)  linux-4.20/.config
'/boot/config-4.13.0-45-generic' -> 'linux-4.20/.config'

(9)  $ make menuconfig沒成功,要先裝ncurses

* Unable to find the ncurses package.

(10)安裝編繹套件成功 

$ sudo apt-get install build-essential libncurses-dev bison flex libssl-dev libelf-dev

(11)再次組態

$ sudo make menuconfig

(12)編譯核心

$ make

 

(13a) sudo apt autoremover


(13b)$  安裝模組:

sudo make modules_install

:

  INSTALL virt/lib/irqbypass.ko
  DEPMOD  4.20.0

(14)列出安裝的modules

$ ls -l /lib/modules/
總計 60
drwxr-xr-x 3 root root 4096  7月 26 14:10 4.13.0-43-generic
drwxr-xr-x 6 root root 4096  7月 11  2018 4.13.0-45-generic
drwxr-xr-x 3 root root 4096 12月 30 06:47 4.15.0-29-generic
drwxr-xr-x 2 root root 4096 12月 29 07:07 4.15.0-30-generic
drwxr-xr-x 3 root root 4096 12月 30 06:47 4.15.0-32-generic
drwxr-xr-x 3 root root 4096 12月 30 06:47 4.15.0-33-generic
drwxr-xr-x 3 root root 4096 12月 30 06:47 4.15.0-34-generic
drwxr-xr-x 3 root root 4096 12月 30 06:47 4.15.0-36-generic
drwxr-xr-x 2 root root 4096  1月 13 06:55 4.15.0-39-generic
drwxr-xr-x 6 root root 4096 12月 14 22:28 4.15.0-42-generic
drwxr-xr-x 6 root root 4096 12月 30 07:43 4.15.0-43-generic
drwxr-xr-x 3 root root 4096  7月 29 12:25 4.17.10
drwxr-xr-x 3 root root 4096  1月 13 06:59 4.20.0
drwxr-xr-x 2 root root 4096  8月 16 23:07 4.4.0-130-generic
drwxr-xr-x 2 root root 4096 12月 30 06:48 4.4.0-141-generic
[treehrt ~/linux-4.20]$

 

(15)列出新編成功的核心,好像有點胖。

ls arch/x86/boot/bzImage -l
-rw-rw-r-- 1 treehrt treehrt 8191328  1月 13 00:03 arch/x86/boot/bzImage

(16)進行核心安裝(會自動更新grub2開機組態,最新核心將為預設開機選項)

$ sudo make install
sh ./arch/x86/boot/install.sh 4.20.0 arch/x86/boot/bzImage \
    System.map "/boot"
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 4.20.0 /boot/vmlinuz-4.20.0
run-parts: executing /etc/kernel/postinst.d/dkms 4.20.0 /boot/vmlinuz-4.20.0
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 4.20.0 /boot/vmlinuz-4.20.0
update-initramfs: Generating /boot/initrd.img-4.20.0
W: Possible missing firmware /lib/firmware/i915/icl_dmc_ver1_07.bin for module i915
run-parts: executing /etc/kernel/postinst.d/pm-utils 4.20.0 /boot/vmlinuz-4.20.0
run-parts: executing /etc/kernel/postinst.d/unattended-upgrades 4.20.0 /boot/vmlinuz-4.20.0
run-parts: executing /etc/kernel/postinst.d/update-notifier 4.20.0 /boot/vmlinuz-4.20.0
run-parts: executing /etc/kernel/postinst.d/zz-update-grub 4.20.0 /boot/vmlinuz-4.20.0

正在產生 grub 設定檔 ...
找到 linux 映像檔:/boot/vmlinuz-4.20.0
找到 initrd 映像檔:/boot/initrd.img-4.20.0
找到 linux 映像檔:/boot/vmlinuz-4.15.0-43-generic
找到 linux 映像檔:/boot/vmlinuz-4.15.0-42-generic
找到 linux 映像檔:/boot/vmlinuz-4.13.0-45-generic
找到 initrd 映像檔:/boot/initrd.img-4.13.0-45-generic
找到 Ubuntu 16.04.5 LTS (16.04) [於 /dev/sdc5]
Adding boot menu entry for EFI firmware configuration
完成
[treehrt ~/linux-4.20]$

 

(17) $  ls /boot -l
總計 534096
-rw-r--r-- 1 root root   1501528  5月 31  2018 abi-4.13.0-45-generic
-rw-r--r-- 1 root root   1538114 11月 19 23:32 abi-4.15.0-42-generic
-rw-r--r-- 1 root root   1235761  7月  9  2018 abi-4.4.0-21-generic
-rw-r--r-- 1 root root    213220  5月 31  2018 config-4.13.0-45-generic
-rw-r--r-- 1 root root    217026 11月 19 23:32 config-4.15.0-42-generic
-rw-r--r-- 1 root root    217026 12月  8 00:05 config-4.15.0-43-generic
-rw-r--r-- 1 root root    213210  7月 29 16:14 config-4.17.10
-rw-r--r-- 1 root root    220889  1月 13 07:40 config-4.20.0
-rw-r--r-- 1 root root    192900  7月  9  2018 config-4.4.0-21-generic
drwx------ 3 root root      4096  1月  1  1970 efi
drwxr-xr-x 5 root root      4096  1月 13 07:42 grub
-rw-r--r-- 1 root root  50330949 12月 15 06:11 initrd.img-4.13.0-45-generic
-rw-r--r-- 1 root root 427412103  1月 13 07:41 initrd.img-4.20.0
-rw-r--r-- 1 root root    182704  1月 28  2016 memtest86+.bin
-rw-r--r-- 1 root root    184380  1月 28  2016 memtest86+.elf
-rw-r--r-- 1 root root    184840  1月 28  2016 memtest86+_multiboot.bin
-rw-r--r-- 1 root root       255  5月 31  2018 retpoline-4.13.0-45-generic
-rw-r--r-- 1 root root         0 11月 19 23:32 retpoline-4.15.0-42-generic
-rw------- 1 root root   3883942  5月 31  2018 System.map-4.13.0-45-generic
-rw------- 1 root root   4047229 11月 19 23:32 System.map-4.15.0-42-generic
-rw------- 1 root root   4047366 12月  8 00:05 System.map-4.15.0-43-generic
-rw-r--r-- 1 root root   3946040  7月 29 16:14 System.map-4.17.10
-rw-r--r-- 1 root root   4140990  1月 13 07:40 System.map-4.20.0
-rw------- 1 root root   3076741  7月  9  2018 System.map-4.4.0-21-generic
-rw------- 1 root root   7712560  5月 31  2018 vmlinuz-4.13.0-45-generic
-rw------- 1 root root   7714488  6月 15  2018 vmlinuz-4.13.0-45-generic.efi.signed
-rw------- 1 root root   8119832 11月 20 18:23 vmlinuz-4.15.0-42-generic
-rw------- 1 root root   8119768 12月  8 17:43 vmlinuz-4.15.0-43-generic
-rw-r--r-- 1 root root   8191328  1月 13 07:40 vmlinuz-4.20.0

(18a) $  lspci | grep VGA
00:02.0 VGA compatible controller: Intel Corporation Device 3e92

cat /proc/cpuinfo | grep "model name"
model name    : Intel(R) Core(TM) i7-8700 CPU @ 3.20GHz
model name    : Intel(R) Core(TM) i7-8700 CPU @ 3.20GHz
model name    : Intel(R) Core(TM) i7-8700 CPU @ 3.20GHz
model name    : Intel(R) Core(TM) i7-8700 CPU @ 3.20GHz
model name    : Intel(R) Core(TM) i7-8700 CPU @ 3.20GHz
model name    : Intel(R) Core(TM) i7-8700 CPU @ 3.20GHz
model name    : Intel(R) Core(TM) i7-8700 CPU @ 3.20GHz
model name    : Intel(R) Core(TM) i7-8700 CPU @ 3.20GHz
model name    : Intel(R) Core(TM) i7-8700 CPU @ 3.20GHz
model name    : Intel(R) Core(TM) i7-8700 CPU @ 3.20GHz
model name    : Intel(R) Core(TM) i7-8700 CPU @ 3.20GHz
model name    : Intel(R) Core(TM) i7-8700 CPU @ 3.20GHz

$ sudo wget https://github.com/wkennington/linux-firmware/raw/master/i915/icl_dmc_ver1_07.bin

 

sudo cp icl_dmc_ver1_07.bin /lib/firmware/i915/

 

(18b) 重開機 $ reboot

 

 

 

(19)核心4.20.0 #1 SMP 於 Sat Jan 5 13:21:51安裝成功:

$ uname -a
Linux treehrt-BM6AE-BM1AE-BP1AE 4.20.0 #1 SMP Sat Jan 5 13:21:51 CST 2019 i686 i686 i686 GNU/Linux

 

(20) 用舊的核心開機取得機器資訊 以了解 missing firmware /lib/firmware/i915/skl_dmc_ver1_27.bin for module i915

$ uname -a
Linux treehrt-BM6AE-BM1AE-BP1AE 4.4.0-121-generic #145-Ubuntu SMP Fri Apr 13 13:46:32 UTC 2018 i686 i686 i686 GNU/Linux

$ lspci | grep VGA
00:02.0 VGA compatible controller: Intel Corporation Xeon E3-1200 v3/4th Gen Core Processor Integrated Graphics Controller (rev 06)

$ cat /proc/cpuinfo | grep "model name"
model name    : Intel(R) Core(TM) i7-4790 CPU @ 3.60GHz
model name    : Intel(R) Core(TM) i7-4790 CPU @ 3.60GHz
model name    : Intel(R) Core(TM) i7-4790 CPU @ 3.60GHz
model name    : Intel(R) Core(TM) i7-4790 CPU @ 3.60GHz
model name    : Intel(R) Core(TM) i7-4790 CPU @ 3.60GHz
model name    : Intel(R) Core(TM) i7-4790 CPU @ 3.60GHz
model name    : Intel(R) Core(TM) i7-4790 CPU @ 3.60GHz
model name    : Intel(R) Core(TM) i7-4790 CPU @ 3.60GHz

(21)用新核心開機成功,但有0.045843 TSC_DEADLINE firmware錯誤訊息

$ uname -a
Linux treehrt-BM6AE-BM1AE-BP1AE 4.20.0 #1 SMP Sat Jan 5 13:21:51 CST 2019 i686 i686 i686 GNU/Linux

treehrt@treehrt-BM6AE-BM1AE-BP1AE:~$  lspci | grep VGA
00:02.0 VGA compatible controller: Intel Corporation Xeon E3-1200 v3/4th Gen Core Processor Integrated Graphics Controller (rev 06)

$  cat /proc/cpuinfo | grep "model name"
model name    : Intel(R) Core(TM) i7-4790 CPU @ 3.60GHz
model name    : Intel(R) Core(TM) i7-4790 CPU @ 3.60GHz
model name    : Intel(R) Core(TM) i7-4790 CPU @ 3.60GHz
model name    : Intel(R) Core(TM) i7-4790 CPU @ 3.60GHz
model name    : Intel(R) Core(TM) i7-4790 CPU @ 3.60GHz
model name    : Intel(R) Core(TM) i7-4790 CPU @ 3.60GHz
model name    : Intel(R) Core(TM) i7-4790 CPU @ 3.60GHz
model name    : Intel(R) Core(TM) i7-4790 CPU @ 3.60GHz

 

 

 

(22)$  locate i915/skl_
/lib/firmware/i915/skl_dmc_ver1.bin
/lib/firmware/i915/skl_dmc_ver1_23.bin
/lib/firmware/i915/skl_dmc_ver1_26.bin
/lib/firmware/i915/skl_guc_ver1.bin
/lib/firmware/i915/skl_guc_ver1_1059.bin
/lib/firmware/i915/skl_guc_ver4.bin
/lib/firmware/i915/skl_guc_ver4_3.bin
/lib/firmware/i915/skl_guc_ver6.bin
/lib/firmware/i915/skl_guc_ver6_1.bin
/lib/firmware/i915/skl_huc_ver01_07_1398.bin

(23)

$cd /lib/firmware/i915/
$ ls
bxt_dmc_ver1_04.bin        kbl_dmc_ver1.bin           skl_guc_ver4_3.bin
bxt_dmc_ver1_05.bin        kbl_huc_ver02_00_1810.bin  skl_guc_ver4.bin
bxt_dmc_ver1_06.bin        skl_dmc_ver1_23.bin        skl_guc_ver6_1.bin
bxt_dmc_ver1_07.bin        skl_dmc_ver1_26.bin        skl_guc_ver6.bin
bxt_dmc_ver1.bin           skl_dmc_ver1.bin           skl_huc_ver01_07_1398.bin
bxt_huc_ver01_07_1398.bin  skl_guc_ver1_1059.bin
kbl_dmc_ver1_01.bin        skl_guc_ver1.bin

(24)

$ sudo wget https://github.com/wkennington/linux-firmware/raw/master/i915/skl_dmc_ver1_27.bin

$ sudo wget https://github.com/wkennington/linux-firmware/raw/master/i915/kbl_dmc_ver1_04.bin

$ sudo wget https://github.com/wkennington/linux-firmware/raw/master/i915/cnl_dmc_ver1_07.bin

$ sudo wget https://github.com/wkennington/linux-firmware/raw/master/i915/kbl_guc_ver9_39.bin

$ sudo wget https://github.com/wkennington/linux-firmware/raw/master/i915/bxt_guc_ver9_29.bin

$ sudo wget https://github.com/wkennington/linux-firmware/raw/master/i915/skl_guc_ver9_33.bin


(25)重裝核心:

$ cd /home/treehrt/linux-4.20

$  sudo make install
 

sh ./arch/x86/boot/install.sh 4.20.0 arch/x86/boot/bzImage \
    System.map "/boot"
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 4.20.0 /boot/vmlinuz-4.20.0
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 4.20.0 /boot/vmlinuz-4.20.0
update-initramfs: Generating /boot/initrd.img-4.20.0
W: Possible missing firmware /lib/firmware/i915/glk_dmc_ver1_04.bin for module i915
W: Possible missing firmware /lib/firmware/i915/icl_dmc_ver1_07.bin for module i915(還有二個)
run-parts: executing /etc/kernel/postinst.d/pm-utils 4.20.0 /boot/vmlinuz-4.20.0
run-parts: executing /etc/kernel/postinst.d/unattended-upgrades 4.20.0 /boot/vmlinuz-4.20.0
run-parts: executing /etc/kernel/postinst.d/update-notifier 4.20.0 /boot/vmlinuz-4.20.0
run-parts: executing /etc/kernel/postinst.d/zz-update-grub 4.20.0 /boot/vmlinuz-4.20.0
正在產生 grub 設定檔 ...
找到 linux 映像檔:/boot/vmlinuz-4.20.0
找到 initrd 映像檔:/boot/initrd.img-4.20.0
找到 linux 映像檔:/boot/vmlinuz-4.20.0.old
找到 initrd 映像檔:/boot/initrd.img-4.20.0
找到 linux 映像檔:/boot/vmlinuz-4.20
找到 linux 映像檔:/boot/vmlinuz-4.4.0-121-generic
找到 initrd 映像檔:/boot/initrd.img-4.4.0-121-generic
找到 linux 映像檔:/boot/vmlinuz-4.4.0-96-generic
找到 initrd 映像檔:/boot/initrd.img-4.4.0-96-generic
找到 linux 映像檔:/boot/vmlinuz-3.13.0-121-generic
找到 initrd 映像檔:/boot/initrd.img-3.13.0-121-generic
找到 linux 映像檔:/boot/vmlinuz-3.13.0-119-generic
找到 initrd 映像檔:/boot/initrd.img-3.13.0-119-generic
Found memtest86+ image: /boot/memtest86+.elf
Found memtest86+ image: /boot/memtest86+.bin
找到 Windows 7 (loader) [於 /dev/sda1]
找到 Windows Recovery Environment (loader) [於 /dev/sda2]
找到 Windows 7 (loader) [於 /dev/sda3]
找到 Fedora release 19 (Schrödinger’s Cat) [於 /dev/mapper/fedora-root]
完成


(26)

$ ls /boot -l|grep 4.20.0
-rw-r--r-- 1 root root    219781  1月  7 20:34 config-4.20.0
-rw-r--r-- 1 root root    219781  1月  5 20:37 config-4.20.0.old
-rw-r--r-- 1 root root 376119216  1月  7 20:37 initrd.img-4.20.0
-rw-r--r-- 1 root root   3172751  1月  7 20:34 System.map-4.20.0
-rw-r--r-- 1 root root   3172751  1月  5 20:37 System.map-4.20.0.old
-rw-r--r-- 1 root root   7630400  1月  7 20:34 vmlinuz-4.20.0
-rw-r--r-- 1 root root   7630400  1月  5 20:37 vmlinuz-4.20.0.old

(27)REBOOT

(28)補上缺少的i915 fireware

$cd /lib/firmware/i915/

$ sudo wget https://github.com/wkennington/linux-firmware/raw/master/i915/glk_dmc_ver1_04.bin

$ sudo wget https://github.com/wkennington/linux-firmware/raw/master/i915/icl_dmc_ver1_07.bin

(29)重安核心成功,終於沒再出現i915的警告。

$ cd /home/treehrt/linux-4.20
$  sudo make install

(30)reboot

仍有0.045843 TSC_DEADLINE firmware問題

tsc_deadline disabled due to errata please update microcode to version 0x3a (or later)

(31)$ sudo apt-get install intel-microcode
:

下列的額外套件將被安裝:
  iucode-tool
下列【新】套件將會被安裝:
  intel-microcode iucode-tool
:

下載:1 http://tw.archive.ubuntu.com/ubuntu xenial-updates/main i386 iucode-tool i386 1.5.1-1ubuntu0.1 [33.5 kB]
下載:2 http://tw.archive.ubuntu.com/ubuntu xenial-updates/main i386 intel-microcode i386 3.20180807a.0ubuntu0.16.04.1 [1,416 kB]

解開 iucode-tool (1.5.1-1ubuntu0.1) 中...
選取了原先未選的套件 intel-microcode。
準備解開 .../intel-microcode_3.20180807a.0ubuntu0.16.04.1_i386.deb ...
解開 intel-microcode (3.20180807a.0ubuntu0.16.04.1) 中...
Processing triggers for man-db (2.7.5-1) ...
設定 iucode-tool (1.5.1-1ubuntu0.1) ...
設定 intel-microcode (3.20180807a.0ubuntu0.16.04.1) ...
update-initramfs: deferring update (trigger activated)
intel-microcode: microcode will be updated at next boot
Processing triggers for initramfs-tools (0.122ubuntu8.11) ...
update-initramfs: Generating /boot/initrd.img-4.20.0

(32)reboot

(33)成功以新核心開機且不再有「tsc_deadline disabled due to errata please update microcode to version 0x3a (or later)」警告訊息。

$ date
一  1月  7 21:54:47 CST 2019

$ uname -a
Linux treehrt-BM6AE-BM1AE-BP1AE 4.20.0 #1 SMP Sat Jan 5 13:21:51 CST 2019 i686 i686 i686 GNU/Linux

 

 
Accessible and Valid XHTML 1.0 Strict and CSS Powered by LifeType