海运的博客

PVE/KVM安装windows遇到的问题

发布时间:December 8, 2021 // 分类: // No Comments

由于windows不包含VirtIO驱动,PVE默认使用ide硬盘很卡,在新建虚拟机时将硬盘ide调整为scsi,额外新建一个cd驱动器挂载virtio-win iso,然后在windows安装界面加载挂载的驱动,windows7最新可用版本为virtio-win-0.1.173
2021-12-07_170730.jpg
windows7安装完成后设备管理器有一未识别设备,下载windows6.x-hypervintegrationservices-x64管理员运行powershell安装。

Dism /online /Add-Package /PackagePath:C:\windows6.x-hypervintegrationservices-x64.cab

参考:
https://forum.proxmox.com/threads/unknown-device-in-win7-vm.49698/
https://forum.proxmox.com/threads/windows-7-and-virtio-drivers-no-signed-drivers-found-for-0-1-185-and-0-1-190-or-bsod-with-0-1-189.79708/
https://pve.proxmox.com/wiki/Paravirtualized_Block_Drivers_for_Windows
https://pve.proxmox.com/wiki/Windows_7_guest_best_practices
https://pve.proxmox.com/wiki/Windows_VirtIO_Drivers

ubuntu挂载samba/smb共享中文乱码

发布时间:December 3, 2021 // 分类: // No Comments

安装smb/samba客户端及手工挂载:

apt-get install cifs-utils
mount -t cifs -o user=user,pass=pass,file_mode=0644,dir_mode=0755 //192.168.1.1/share /mnt/
#有的参数不一样并需要指定版本
#mount -t cifs -o username=user,password=pass,iocharset=utf8,vers=3.0 //192.168.1.1/temp /mnt/

修改fstab配置文件开机自动挂载:

cat /etc/fstab
//192.168.1.1/share /mnt               cifs    user=user,pass=pass 0       0

如果中文乱码先查看编码是否为utf8:

cat /etc/default/locale 
LANG="en_US.UTF-8"
LANGUAGE="en_US:en"
#LANG="zh_CN.UTF-8"
#LANGUAGE="zh_CN:zh"

查看是否安装nls_utf8内核模块:

ls /lib/modules/$(uname -r)/kernel/fs/nls/nls_utf8.ko

安装nls_utf8内核模块:

apt install linux-modules-extra-$(uname -r)

还是不行挂载添加指定utf8编码:

iocharset=utf8

参考:
https://askubuntu.com/questions/519796/unable-to-mount-cifs-with-iocharset-utf8

ubuntu/debian软件降级

发布时间:November 27, 2021 // 分类: // No Comments

升级了下PVE系统关机很慢,查看日记提示错误:

pvescheduler.service: Stopping timed out. Terminating.

将更新的pve-manager降级解决:

#查看pve-manager历史版本
apt-cache madison pve-manager 
#安装升级前的版本
apt install pve-manager=7.1-5

参考:
https://www.cnblogs.com/EasonJim/p/7144017.html
https://www.linuxadictos.com/zh-CN/%E9%99%8D%E7%BA%A7.html

Linux查看CPU/主板/网卡/硬盘温度

发布时间:November 27, 2021 // 分类: // 1 Comment

方法一:

apt install lm-sensors hddtemp
sensors
hddtemp /dev/sd?

方法二,数值除以1000就是真实温度

grep . /sys/class/thermal/thermal_zone*/type
/sys/class/thermal/thermal_zone0/type:acpitz
/sys/class/thermal/thermal_zone1/type:acpitz
/sys/class/thermal/thermal_zone2/type:x86_pkg_temp

grep . /sys/class/thermal/thermal_zone*/temp
/sys/class/thermal/thermal_zone0/temp:27800  
/sys/class/thermal/thermal_zone1/temp:29800
/sys/class/thermal/thermal_zone2/temp:29000

下面这个更全面,包含所有cpu核心及i350网卡温度:

grep . /sys/class/hwmon/hwmon*/name
/sys/class/hwmon/hwmon0/name:acpitz
/sys/class/hwmon/hwmon1/name:i350bb
/sys/class/hwmon/hwmon2/name:coretemp

grep . /sys/class/hwmon/hwmon*/temp*input
/sys/class/hwmon/hwmon0/temp1_input:27800
/sys/class/hwmon/hwmon0/temp2_input:29800
/sys/class/hwmon/hwmon1/temp1_input:42000
/sys/class/hwmon/hwmon2/temp1_input:29000
/sys/class/hwmon/hwmon2/temp2_input:28000
/sys/class/hwmon/hwmon2/temp3_input:28000
/sys/class/hwmon/hwmon2/temp4_input:29000
/sys/class/hwmon/hwmon2/temp5_input:28000

读取硬盘SMART查看温度:

ls -1 /dev/sd? | xargs -n1 smartctl -A | grep Celsius

参考:
https://developer.toradex.com/knowledge-base/temperature-sensor-linux

Proxmox LXC挂载目录及权限设置

发布时间:November 26, 2021 // 分类: // No Comments

PVE LXC挂载目录服务器目录到容器内:

cat /etc/pve/lxc/100.conf 
mp0: /data/e,mp=/data/e
mp1: /data/f,mp=/data/f

LXC为了安全默认为无特权容器,容器内程序以root的子用户运行,容器内要写挂载的文件要在服务器内为指定的子用户设置相应权限。
查看root的默认从属用户起始id为100000,数量65536个。

grep root /etc/subgid /etc/subuid
/etc/subgid:root:100000:65536
/etc/subuid:root:100000:65536

配置映射从属用户到lxc容器,默认lxc容器内root(id=0)映射为服务器id 100000,递增65536个,即容器内用户id 0-65535对应服务器100000-165535。

cat /etc/pve/lxc/100.conf 
lxc.idmap: u 0 100000 65536
lxc.idmap: g 0 100000 65536

注意容器内nobody id为65534,没映射到会连接不上ssh,提示错误:

fatal: setgroups: Invalid argument [preauth]

如果将挂载目录让容器内root可读写的话在服务器内将所有者更改为id 100000。

chown -R 100000:100000 /data/e
#也可使用用户名
useradd -u 100000 -M -s -s /usr/sbin/nologin lxc-root 
groupmod -g 100000 lxc-root
chown -R lxc-root:lxc-root /data/e

为方便管理可将服务器实体用户映射为容器内指定用户,需先将服务器内的实体用户id添加为root的子用户(其它用户不行),如添加id为1005的用户。

grep root /etc/subuid /etc/subgid
/etc/subgid:root:100000:65536
/etc/subgid:root:1005:1
/etc/subuid:root:100000:65536
/etc/subuid:root:1005:1

配置lxc将服务器id 1005映射为容器内id 1005,其它为root虚拟子用户。

#lxc内id 0到1005映射为服务器id 100000到101005
lxc.idmap: u 0 100000 1005
lxc.idmap: g 0 100000 1005
#将lxc内id 1005映射为服务器id 1005实体用户
lxc.idmap: u 1005 1005 1
lxc.idmap: g 1005 1005 1
#lxc剩下的id 1006到65535映射为服务器id 101006到165535
lxc.idmap: u 1006 101006 64530
lxc.idmap: g 1006 101006 64530

参考:
https://pve.proxmox.com/wiki/Unprivileged_LXC_containers
https://forum.proxmox.com/threads/newuidmap-uid-range-1100-1101-1100-1101-not-allowed.73414/

分类
最新文章
最近回复
  • opnfense: 谢谢博主!!!解决问题了!!!我之前一直以为内置的odhcp6就是唯一管理ipv6的方式
  • liyk: 这个方法获取的IPv6大概20分钟之后就会失效,默认路由先消失,然后Global IPV6再消失
  • 海运: 不好意思,没有。
  • zongboa: 您好,請問一下有immortalwrt設定guest Wi-Fi的GUI教學嗎?感謝您。
  • 海运: 恩山有很多。
  • swsend: 大佬可以分享一下固件吗,谢谢。
  • Jimmy: 方法一 nghtp3步骤需要改成如下才能编译成功: git clone https://git...
  • 海运: 地址格式和udpxy一样,udpxy和msd_lite能用这个就能用。
  • 1: 怎么用 编译后的程序在家里路由器内任意一台设备上运行就可以吗?比如笔记本电脑 m参数是笔记本的...
  • 孤狼: ups_status_set: seems that UPS [BK650M2-CH] is ...
归档