CPU | Core i5 (8Gen) 6Core 3GHz |
MEM | 32GB |
SSD | 512GB |
HDD | 1TB |
GPU | RTX2070 8GB |
SSD | /boot/efi | efi | 537MB | 537MBの根拠は http://www.rodsbooks.com/efi-bootloaders/principles.html |
SSD | / | ext4 | 512GB | |
HDD | swap | 128GB | hibernateのため、最低必要量(メモリ容量の2倍)の2倍を確保 | |
HDD | /home | ext4 | 256GB | まぁ余裕見て |
HDD | /opt | ext4 | 547GB | kubernates/dockerのイメージとか、Dataとか |
$ sudo apt install pm-utils $ sudo apt install molly-guard $ sudo apt install uswsusp
- HIBERNATE_MODE=shutdown + HIBERNATE_MODE=platform
$ sudo systemctl hibernateor
$ sudo systemctl hybrid-sleep
/var/crash$ sudo cat susres.2020-03-30_22\:34\:41.394025.crash ProblemType: KernelOops Annotation: This occurred during a previous hibernation, and prevented the system from resuming properly. Architecture: amd64 ... Package: linux-image-5.3.0-42-generic 5.3.0-42.34~18.04.1 ...
$ LANG=C xdg-user-dirs-gtk-update
$ cat /etc/os-release NAME="Ubuntu" VERSION="18.04.4 LTS (Bionic Beaver)" ID=ubuntu ID_LIKE=debian PRETTY_NAME="Ubuntu 18.04.4 LTS" VERSION_ID="18.04" HOME_URL="https://www.ubuntu.com/" SUPPORT_URL="https://help.ubuntu.com/" BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/" PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy" VERSION_CODENAME=bionic UBUNTU_CODENAME=bionic $ uname -a Linux GPU1 5.3.0-42-generic #34~18.04.1-Ubuntu SMP Fri Feb 28 13:42:26 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
適用可否 | ドライバ | Linux Kernel 5 | 備考 |
○ | https://github.com/cilynx/rtl88x2bu | 対応 | |
☓ | https://github.com/RinCat/RTL88x2BU-Linux-Driver.git | 対応 | kernelエラー |
☓ | https://github.com/jeremyb31/rtl8822bu | 未対応 |
$ sudo apt install git make gcc dkmsあとは配布元の指示に従って make する
$ iw dev phy#0 Interface wlx503eaadaff7a ifindex 4 wdev 0x1 addr **:**:**:**:**:** ssid ap********** type managed txpower 12.00 dBm
# Let NetworkManager manage all devices on this system network: version: 2 renderer: NetworkManager wifis: wlx503eaadaff7a: addresses: [] dhcp4: true optional: true access-points: ap********: password: **********
$ sudo netplan apply
$ sudo apt install openssh-server openssh-client
これでサービス起動の設定までされちゃう。
鍵ペアを作って
$ ssh-keygen -t rsa $ cd .ssh/ $ ls id_rsa id_rsa.pub $ cat id_rsa.pub >> authorized_keys
秘密鍵を USB メモリでノートパソコン (Chromebook の Linux VM *1) に持っていけば、計算機にモニタをつないでの作業は終わり
/.ssh/config に登録する
$ nvidia-smi Tue Mar 31 16:47:36 2020 +-----------------------------------------------------------------------------+ | NVIDIA-SMI 435.21 Driver Version: 435.21 CUDA Version: 10.1 | |-------------------------------+----------------------+----------------------+ | GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC | | Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. | |===============================+======================+======================| | 0 GeForce RTX 2070 Off | 00000000:01:00.0 Off | N/A | | 20% 43C P8 19W / 175W | 167MiB / 7982MiB | 4% Default | +-------------------------------+----------------------+----------------------+ +-----------------------------------------------------------------------------+ | Processes: GPU Memory | | GPU PID Type Process name Usage | |=============================================================================| | 0 1456 G /usr/lib/xorg/Xorg 96MiB | | 0 1627 G /usr/bin/gnome-shell 69MiB | +-----------------------------------------------------------------------------+
$ sudo apt-get remove docker docker-engine docker.io containerd runc $ sudo apt-get update $ sudo apt-get install \ apt-transport-https \ ca-certificates \ curl \ gnupg-agent \ software-properties-common $ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - $ sudo add-apt-repository \ "deb [arch=amd64] https://download.docker.com/linux/ubuntu \ $(lsb_release -cs) \ stable" $ apt-get update $ sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin $ sudo docker run hello-world Hello from Docker! This message shows that your installation appears to be working correctly. $ docker --version Docker version 19.03.8, build afacb8b7f0
$ distribution=$(. /etc/os-release;echo $ID$VERSION_ID) $ curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | sudo apt-key add - $ curl -s -L https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.list | sudo tee /etc/apt/sources.list.d/nvidia-docker.list $ sudo apt-get update && sudo apt-get install -y nvidia-container-toolkit $ sudo systemctl restart docker
$ # sudo docker run --gpus all --rm nvcr.io/nvidia/cuda nvidia-smi Sun Sep 5 03:33:24 2021 +-----------------------------------------------------------------------------+ | NVIDIA-SMI 460.91.03 Driver Version: 460.91.03 CUDA Version: 11.2 | |-------------------------------+----------------------+----------------------+ | GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC | | Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. | | | | MIG M. | |===============================+======================+======================| | 0 GeForce RTX 2070 Off | 00000000:01:00.0 Off | N/A | | 18% 35C P8 18W / 175W | 13MiB / 7982MiB | 0% Default | | | | N/A | +-------------------------------+----------------------+----------------------+ +-----------------------------------------------------------------------------+ | Processes: | | GPU GI CI PID Type Process name GPU Memory | | ID ID Usage | |=============================================================================| +-----------------------------------------------------------------------------+
--gpus all | 全部使う |
--gpus 1 | 1基使う |
--gpus '"device=0,1"' | 0番目と1番目を使う |
$ sudo groupadd docker $ sudo gpasswd -a $USER docker $ sudo systemctl restart docker
version: "3.9"
services:
samba:
image: vimagick/samba
volumes:
- /data/samba/smb.conf:/etc/samba/smb.conf
- /data/samba/share:/share
tty: yes
network_mode: "host"
restart: always
$ sudo apt install python3-pip $ sudo pip install docker-compose $ docker-compose -version docker-compose version 1.29.2, build unknown
cf. https://github.com/docker/compose
$ sudo snap stop --disable microk8s
$ sudo snap install microk8s --classic --channel=1.18/stable
$ sudo microk8s status --wait-ready microk8s is running addons: cilium: disabled dashboard: disabled dns: disabled fluentd: disabled gpu: disabled helm: disabled helm3: disabled ingress: disabled istio: disabled jaeger: disabled knative: disabled kubeflow: disabled linkerd: disabled metallb: disabled metrics-server: disabled prometheus: disabled rbac: disabled registry: disabled storage: disabledほーほー、一通り揃ってますね。全部 disabled だけど
$ sudo microk8s enable dns dashboard registry:size=40Gi
$ sudo usermod -a -G microk8s $USER
/.bash_aliases
alias kubectl='microk8s kubectl'kubectl は microk8s コマンドのオプションで実装されているけど、alias で普通の kubectl のように使える
$ kubectl get nodes NAME STATUS ROLES AGE VERSION gpu1 Ready <none> 40m v1.18.0
$ microk8s start $ microk8s stopOS起動時に自動起動される
$ sudo microk8s.enable gpu Enabling NVIDIA GPU NVIDIA kernel module detected dns is already enabled Applying manifest daemonset.apps/nvidia-device-plugin-daemonset created NVIDIA is enabled
apiVersion: v1 kind: Pod metadata: name: hello-gpu spec: containers: - name: cuda image: nvidia/cuda:latest tty: true
$ kubectl create -f hello-gpu.yml $ kubectl exec -it hello-gpu -- nvidia-smi Tue Mar 31 12:58:59 2020 +-----------------------------------------------------------------------------+ | NVIDIA-SMI 435.21 Driver Version: 435.21 CUDA Version: 10.1 | |-------------------------------+----------------------+----------------------+ | GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC | | Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. | |===============================+======================+======================| | 0 GeForce RTX 2070 Off | 00000000:01:00.0 Off | N/A | | 18% 28C P8 17W / 175W | 0MiB / 7982MiB | 0% Default | +-------------------------------+----------------------+----------------------+ +-----------------------------------------------------------------------------+ | Processes: GPU Memory | | GPU PID Type Process name Usage | |=============================================================================| | No running processes found | +-----------------------------------------------------------------------------+ふー。ひとまず構築は完了
$ sudo add-apt-repository ppa:graphics-drivers/ppa $ sudo apt update $ ubuntu-drivers devices == /sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0 == modalias : pci:v000010DEd00001F02sv00001462sd00003731bc03sc00i00 vendor : NVIDIA Corporation model : TU106 [GeForce RTX 2070] driver : nvidia-driver-450 - distro non-free recommended driver : nvidia-driver-450-server - distro non-free driver : nvidia-driver-440-server - distro non-free driver : nvidia-driver-418-server - distro non-free driver : nvidia-driver-435 - distro non-free driver : xserver-xorg-video-nouveau - distro free builtin $ sudo ubuntu-drivers autoinstall ※または、$ sudo apt install nvidia-driver-450 $ nvidia-smi上手く行かない場合は
$ sudo apt purge libnvidia-gl-*を試してみる
# shutdown -fを実行すると /fastboot ファイルができる。initd は /fastboot があると fsck を実行する。
# shutdown -Fでシャットダウンする。
fsck.mode=force fsck.repair=yes
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash fsck.mode=force fsck.repair=yes"
$ sudo update-grub $ sudo shutdown -h now
UUID=e8f6d417-8380-46ee-9226-057f98f45af9 / ext4 errors=remount-ro 0 1 UUID=BCA9-C273 /boot/efi vfat umask=0077 0 1 /dev/disk/by-uuid/9b2c6bc7-8bc9-4e50-b84f-5e9226d82624 none swap sw 0 0 /dev/disk/by-uuid/828c9042-8824-4281-85d9-b8f402827aac /var ext4 nodev,nofail 0 2題6パラメータ(最後のパラメータ) で fsck の振る舞いを設定する
0 | fsckを実行しない |
1 | システム領域(/),fsckを実行 |
2 | その他領域,fsckを実行 |