方法四
- 保持未连接网络
- 在连接网络界面按
<Shift> + <F10>
- 命令行输入
oobe\bypassnro.cmd
- 选择 我没有Internet连接
- 选择继续执行受限设置
<Shift> + <F10>
oobe\bypassnro.cmd
将虚拟机安装的系统完整拷贝为img文件,并做成U盘系统的方案
qemu-img convert -f vmdk -O raw image.vmdk image.img
findmnt -nosource /
/dev/sda3
growpart /dev/sda 3
resize2fs /dev/sda3
/
package main
import (
"os"
"os/exec"
"strings"
)
func main() {
if os.Geteuid() != 0 {
// fmt.Println("This script must be run as root")
os.Exit(1)
}
// Identify the device that / is mounted on
out, err := exec.Command("df", "/").Output()
if err != nil {
// fmt.Println("Error running df command:", err)
os.Exit(1)
}
// Parse the output to get the device
lines := strings.Split(string(out), "\n")
if len(lines) < 2 {
// fmt.Println("Unexpected output from df command")
os.Exit(1)
}
fields := strings.Fields(lines[1])
if len(fields) < 1 {
// fmt.Println("Unexpected output from df command")
os.Exit(1)
}
device := fields[0]
// fmt.Println("Device:", device)
// Extract the base device and partition number
var baseDevice, partNum string
if strings.HasPrefix(device, "/dev/mapper/") {
baseDevice = strings.TrimSuffix(device, "1")
partNum = "1"
} else {
baseDevice = strings.TrimRightFunc(device, func(r rune) bool {
return r >= '0' && r <= '9'
})
partNum = strings.TrimPrefix(device, baseDevice)
}
// Grow the partition
if err := exec.Command("growpart", baseDevice, partNum).Run(); err != nil {
// fmt.Println("Error running growpart command:", err)
os.Exit(1)
}
// Resize the filesystem
if err := exec.Command("resize2fs", device).Run(); err != nil {
// fmt.Println("Error running resize2fs command:", err)
os.Exit(1)
}
}
go mod init expand_disk
go mod tidy
GOOS=linux GOARCH=amd64 go build .
expand_disk.service
[Unit]
Description=Expand disk partition mounted on /
After=initrd-usr-fs.target
[Service]
ExecStart=/usr/local/bin/expand_disk
[Install]
WantedBy=multi-user.target
sudo cp expand_disk.service /usr/lib/system/systemd/
sudo systemctl enable expand_disk
for inter in $(ls /sys/class/net); do
if [[ $inter != 'lo' ]]; then
cat << EOF > /etc/netplan/99-$inter.yaml
network:
ethernets:
$inter:
dhc4: true
version: 2
renderer: networkd
EOF
ip link set dev $inter up
fi
done
netplan apply
ip a
/etc/netplan/gen_netplan_config.sh
#!/bin/env bash
umask 377
for inter in $(ls /sys/class/net); do
if [[ $inter != 'lo' ]] && [[ ! -e /etc/netplan/99-$inter.yaml ]]; then
cat << EOF > /etc/netplan/99-$inter.yaml
network:
ethernets:
$inter:
dhcp4: true
version: 2
renderer: networkd
EOF
ip link set dev $inter up
fi¡™™¡
done
netplan apply
/usr/lib/systemd/system/wait-netplan-dhcp.service
3[Unit]
Description=Generate DHCP networking DHCP demo for netplan
Before=network-online.target
[Service]
ExecStart=/etc/netplan/gen_netplan_config.sh
[Install]
WantedBy=multi-user.target
systemctl start wait-netplan-dhcp
systemctl enable wait-netplan-dhcp
Runsudo systemctl edit getty@tty1.service
[Service]
ExecStart=
ExecStart=-/sbin/agetty --noissue --autologin myusername %I $TERM
Type=idle
sudo rm -rf /var/cache/snapd/
sudo apt autoremove --purge snapd gnome-software-plugin-snap
rm -fr ~/snap
sudo apt-mark hold snapd
sudo vim /etc/docker/daemon.json
{
"proxies": {
"http-proxy": "http://proxy.example.com:80",
"https-proxy": "https://proxy.example.com:443",
"no-proxy": "*.test.example.com,.example.org"
}
}
{
"allow-nondistributable-artifacts": [],
"api-cors-header": "",
"authorization-plugins": [],
"bip": "",
"bridge": "",
"cgroup-parent": "",
"containerd": "/run/containerd/containerd.sock",
"containerd-namespace": "docker",
"containerd-plugin-namespace": "docker-plugins",
"data-root": "",
"debug": true,
"default-address-pools": [{
"base": "172.30.0.0/16",
"size": 24
},
{
"base": "172.31.0.0/16",
"size": 24
}
],
"default-cgroupns-mode": "private",
"default-gateway": "",
"default-gateway-v6": "",
"default-network-opts": {},
"default-runtime": "runc",
"default-shm-size": "64M",
"default-ulimits": {
"nofile": {
"Hard": 64000,
"Name": "nofile",
"Soft": 64000
}
},
"dns": [],
"dns-opts": [],
"dns-search": [],
"exec-opts": [],
"exec-root": "",
"experimental": false,
"features": {},
"fixed-cidr": "",
"fixed-cidr-v6": "",
"group": "",
"hosts": [],
"proxies": {
"http-proxy": "http://proxy.example.com:80",
"https-proxy": "https://proxy.example.com:443",
"no-proxy": "*.test.example.com,.example.org",
},
"icc": false,
"init": false,
"init-path": "/usr/libexec/docker-init",
"insecure-registries": [],
"ip": "0.0.0.0",
"ip-forward": false,
"ip-masq": false,
"iptables": false,
"ip6tables": false,
"ipv6": false,
"labels": [],
"live-restore": true,
"log-driver": "json-file",
"log-level": "",
"log-opts": {
"cache-disabled": "false",
"cache-max-file": "5",
"cache-max-size": "20m",
"cache-compress": "true",
"env": "os,customer",
"labels": "somelabel",
"max-file": "5",
"max-size": "10m"
},
"max-concurrent-downloads": 3,
"max-concurrent-uploads": 5,
"max-download-attempts": 5,
"mtu": 0,
"no-new-privileges": false,
"node-generic-resources": [
"NVIDIA-GPU=UUID1",
"NVIDIA-GPU=UUID2"
],
"oom-score-adjust": 0,
"pidfile": "",
"raw-logs": false,
"registry-mirrors": [],
"runtimes": {
"cc-runtime": {
"path": "/usr/bin/cc-runtime"
},
"custom": {
"path": "/usr/local/bin/my-runc-replacement",
"runtimeArgs": [
"--debug"
]
}
},
"seccomp-profile": "",
"selinux-enabled": false,
"shutdown-timeout": 15,
"storage-driver": "",
"storage-opts": [],
"swarm-default-advertise-addr": "",
"tls": true,
"tlscacert": "",
"tlscert": "",
"tlskey": "",
"tlsverify": true,
"userland-proxy": false,
"userland-proxy-path": "/usr/libexec/docker-proxy",
"userns-remap": ""
}
(gdb) break iter.c:6 if i == 5
w32tm /config /syncfromflags:manual /reliable:yes /update /manualpeerlist:"192.168.188.188 192.168.188.168"
w32tm /resync
Traceback (most recent call last):
File "requests\compat.py", line 11, in <module>
ModuleNotFoundError: No module named 'chardet'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "minarca_client\main.py", line 15, in <module>
from minarca_client.core import (
File "PyInstaller\loader\pyimod03_importers.py", line 495, in exec_module
File "minarca_client\core\__init__.py", line 23, in <module>
import requests
File "PyInstaller\loader\pyimod03_importers.py", line 495, in exec_module
File "requests\__init__.py", line 45, in <module>
File "PyInstaller\loader\pyimod03_importers.py", line 495, in exec_module
File "requests\exceptions.py", line 9, in <module>
File "PyInstaller\loader\pyimod03_importers.py", line 495, in exec_module
File "requests\compat.py", line 13, in <module>
File "PyInstaller\loader\pyimod03_importers.py", line 495, in exec_module
File "charset_normalizer\__init__.py", line 24, in <module>
File "PyInstaller\loader\pyimod03_importers.py", line 495, in exec_module
File "charset_normalizer\api.py", line 5, in <module>
File "PyInstaller\loader\pyimod03_importers.py", line 495, in exec_module
File "charset_normalizer\cd.py", line 9, in <module>
ModuleNotFoundError: No module named 'charset_normalizer.md__mypyc'
pyinstaller --hiddenimport charset_normalizer.md__mypyc