thinkpad x280 安装macos和win双系统

thinkpad x280 安装macos和win双系统

需要的系统有macos(用来制作macos启动盘;也可以自行找镜像,用windows制作),windows(用来制作win启动盘,winpe启动盘)

1、安装windows

一开始安装的时候,需要注意的坑,efi分区windows只有100m,不够存储的,所以要先划分一个足够大的区分比如500m,在windows安装的分区前面(也即不要选全盘安装)。

用windows安装程序,分出3个分区,第一个分区500m用来扩展efi分区,第二个分区100g以上,用来安装windows,第三个分区50g以上,用来安装macos。

然后选择安装到第二个分区,Windows安装文件会自动把第二个分区切成3个分区(efi分区,mbr分区等),直接下一步即可

2、扩展efi分区

这里采用的是pe修改的方法,深度pe不行,老毛桃的还可以,就是下载慢一些。主要是用到了diskpart组件;

首先用disk genius来备份efi分区里面的efi文件夹。

然后删除efi分区:

进入命令行,

#请先用list disk 查看磁盘编号 假定是0
select disk 0
select partition 0
delete partition override
然后新建大的EFI分区,之后用disk genius将刚才的efi文件夹拷贝到新的efi分区里面。
select disk 0
create partition efi
#不用加size参数,即可直接占据未分配的空间
format quick fs=fat32 label="EFI"
#一定要加format,其他地方无法格式化efi分区

3、双系统引导

这里采用的是扩大efi分区的方式,然后用refind来进行引导;也可以才用一个硬盘双efi分区的方式,原则上refind也能识别。

不要用oc来引导windows,因为oc的acpi文件会影响windows的启动,可以编辑efi里面的acpi文件夹下面的aml文件来适配多系统,但是太麻烦了,还是建议用refind来引导。

4、准备macos安装盘

可以用macos的u盘制作工具来制作u盘。然后用opencore configurator来挂载efi分区(通知栏的图标点击);然后用finder来编辑efi文件夹。

参见https://zhuanlan.zhihu.com/p/681793562

oc驱动只更新到了macos13,如果升14,至少需要换intel的wifi驱动到最新版。

用这个里面的EFI/BOOT文件夹,编辑loader部分,指向实际的efi文件

loader EFI\OC\OpenCore.efi

https://github.com/waldir-xam/x280-Hackintosh/

用这个里面的EFI/OC文件夹

https://github.com/0x8008/x280-hackintosh

用步骤2里面的Microsoft文件夹,放到EFI/Microsoft里面

5、安装macos

需要配置bios,参见https://github.com/0x8008/x280-hackintosh或者下面的文字摘抄。

然后引导到4步的安装盘即可,然后安装到macos分区即可。

The bios must be properly configured prior to installing macOS. In Security menu, set the following settings:
Security > Security Chip: must be Disabled
Memory Protection > Execution Prevention: must be Enabled
Virtualization > Intel Virtualization Technology: must be Enabled
Virtualization > Intel VT-d Feature: must be Enabled
Anti-Theft > Computrace -> Current Setting: must be Disabled
Secure Boot > Secure Boot: must be Disabled
Intel SGX -> Intel SGX Control: must be Disabled
Device Guard: must be Disabled
In Startup menu, set the following options:
UEFI/Legacy Boot: UEFI Only
CSM Support: No
In Thunderbolt menu, set the following options:
Thunderbolt BIOS Assist Mode: Disabled. Do NOT set this to anything else, as it is known to cause potential bricks on the X280, which you won't be able to fix at home!
Wake by Thunderbolt(TM) 3: No
Security Level: No
Support in Pre Boot Environment > Thunderbolt(TM) device: No

6、安装后工作

安装好macOS之后,可以直接用OpenCore Configurator来挂载主机的efi分区,然后把u盘的efi文件夹拷贝进去即可。原文采用了Windows方式,需要装winpe。

https://github.com/benbaker76/Hackintool/releases

Hackintool可以查看驱动情况,然后点击工具部分,下面有一个可以生成windows utc时间同步的注册表,这样双系统就不会有时间差了。

0x8008的oc驱动还是比较全的,不支持4k外接显示屏。

7、蓝牙驱动(不需要打这个蓝牙驱动)

遇到一个奇怪的bug,蓝牙连鼠标可以稳定运行,但是AirPods不行,连接AirPods会导致蓝牙直接关闭。
做了两件事,一个是更新kext驱动,参见,一个是下面的,修改Config.plist文件,目前看还好。(更新一下,应该是睡眠唤醒后,蓝牙驱动会异常,可以关闭蓝牙状态栏和设置里面都关掉,然后都开启,就好了)
https://www.reddit.com/r/hackintosh/comments/13wsrk0/bluetooth_not_working_intel/
https://github.com/valnoxy/t480-oc/issues/104
Add the following keys under NVRAM > Add > 7C436110-AB2A-4BBB-A880-FE41995C9F82:
 <key>bluetoothInternalControllerInfo</key>
 <data>AAAAAAAAAAAAAAAAAAA=</data>
 <key>bluetoothExternalDongleFailed</key>
 <data>AA==</data>

更新一下,应该是睡眠唤醒后,蓝牙驱动会异常,可以关闭蓝牙状态栏和设置里面都关掉,然后都开启,就好了。有一个自动化启停的脚本,我懒得试了。手工启停还行。

解决-黑苹果-睡眠唤醒-蓝牙不正常工作、睡死 – MrSu – 博客园

ChromeBox CN65安装黑苹果

主要参考这个https://www.sqlsec.com/2023/07/macbox.html#U-%E7%9B%98%E5%88%BB%E5%BD%95
说一下几个区别

刷bios


1、刷bios的时候,需要用有线键盘,USB键盘没识别
2、第一次重启会报错,是因为没办法联网,请配置代理后重启
3、新版的chromeos是不能通过ctrl alt +t 的ChromeOS Shell (CROSH) 来运行sudo的,需要alt+ctrl + F2 进入tty命令行模式,用户名root;alt+ctrl + F1返回图形界面


制作启动 U 盘


1、我采用的是下载官方镜像用macos来制作启动u盘,https://osxdaily.com/where-download-macos-installers/
2、下载macos 13.6之后,用mac直接双击安装
3、sudo /Applications/Install\ macOS\ Ventura.app/Contents/Resources/createinstallmedia –volume /Volumes/MyVolume
参考 https://support.apple.com/zh-cn/101578 https://support.apple.com/en-sg/101578
4、efi我采用的是Windows下用DiskGenius来复制;理论上也可以用OpenCore Configurator来挂载efi分区来复制到u盘
5、制作u盘太折腾了,dd复制了一份 dd if=/dev/zero of=upload_test bs=file_size,方便后续操作。mac的dd不能显示进度,可以在命令行执行ctrl+t显示dd进度。


添加 EFI


1、安装好macOS之后,可以直接用OpenCore Configurator来挂载主机的efi分区,然后把u盘的efi文件夹拷贝进去即可。原文采用了Windows方式,需要装winpe。
2、另,https://github.com/sqlsec/Asus-ChromeBox-i7-8550U/ 这个git假设已经换了网卡,实现无线网卡的免驱;实际上不用换网卡,可以用开源驱动来处理。下载下面三个 release,然后把其中四个拖入到efi下面的oc/kexts 文件夹里,然后选中四个文件拖拽到OpenCore Configurator的kernel内核设置里面就好了;(lilu.kext要放在前面 有依赖关系)
BlueToolFixup
IntelBTPatcher
IntelBluetoothFirmware
AirportItlwm
https://github.com/OpenIntelWireless/itlwm/releases
https://github.com/acidanthera/BrcmPatchRAM/releases
https://github.com/OpenIntelWireless/IntelBluetoothFirmware/releases
参考
https://blog.csdn.net/weixin_45518621/article/details/127606193
3、貌似长期不用会导致无线网卡看起来连上,但是没有网或者很卡,ping不通,去显示器设置里面,启用了 屏幕关闭后阻止休眠。目前看起来还好

esxi 启用NGINX

首先NGINX最好不要暴露到公网,如果一定有需求的话,请用二次验证。

如果是esxi7及以下,NGINX参考配置如下https://gist.github.com/dbrownidau/38e044411a02530ec3481078fe2d81d8

如果是esxi8以上的话,用swag的proxy.conf的标准配置就好了,具体如下

## Version 2023/02/09 - Changelog: https://github.com/linuxserver/docker-swag/commits/master/root/defaults/nginx/proxy.conf.sample

# Timeout if the real server is dead
proxy_next_upstream error timeout invalid_header http_500 http_502 http_503;

# Proxy Connection Settings
proxy_buffers 32 4k;
proxy_connect_timeout 240;
proxy_headers_hash_bucket_size 128;
proxy_headers_hash_max_size 1024;
proxy_http_version 1.1;
proxy_read_timeout 240;
proxy_redirect http:// $scheme://;
proxy_send_timeout 240;

# Proxy Cache and Cookie Settings
proxy_cache_bypass $cookie_session;
#proxy_cookie_path / "/; Secure"; # enable at your own risk, may break certain apps
proxy_no_cache $cookie_session;

# Proxy Header Settings
proxy_set_header Connection $connection_upgrade;
proxy_set_header Early-Data $ssl_early_data;
proxy_set_header Host $host;
proxy_set_header Proxy "";
proxy_set_header Upgrade $http_upgrade;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Method $request_method;
proxy_set_header X-Forwarded-Port $server_port;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-Ssl on;
proxy_set_header X-Forwarded-Uri $request_uri;
proxy_set_header X-Original-Method $request_method;
proxy_set_header X-Original-URL $scheme://$http_host$request_uri;
proxy_set_header X-Real-IP $remote_addr;

红米AC2100 刷OpenWrt,用wpad实现网线的eap(8021X)验证

红米AC2100是一款性价比较高且备受欢迎的家用无线路由器。使用原厂固件时,虽然它具备了基本的路由功能,但却存在一些限制和缺乏灵活性。如果你希望扩展路由器的功能、提升性能或获得更多自定义化选项,刷入OpenWrt固件是一个不错的选择。

OpenWrt是一个基于Linux的开源固件,提供了丰富的包管理系统、广泛的硬件支持以及强大的网络管理功能。通过刷入OpenWrt,你可以获得以下好处:

刷入breed

参考:https://www.bilibili.com/read/cv23096971/

breed如果路由器可以联网的话可以比较简单的刷入;参考链接或者百度;上面文件是有漏洞的2.07固件

下载:https://breed.hackpascal.net/ breed-mt7621-xiaomi-r3g

刷入openwrt

刷好breed之后,拔掉电源,然后按住reset按钮,插入电源,长按大概3秒钟,AC2100的指示灯会变红闪烁几次,然后就可以松开reset按键。

访问192.168.1.1,更新固件,选择固件的时候手动选择openwrt布局;然后上传下面链接里面下载这个最新的rootfs0he kenerl1文件(如果不是最新的breed不支持这两个文件刷入)

下载: https://openwrt.org/toh/xiaomi/xiaomi_redmi_router_ac2100

实现网线的peap验证

参考:https://gist.github.com/LupusArgentum/0a03106c0484480376b5878ca4f30761

padavan固件可以原生支持eap验证,openwrt需要一些配置,

opkg update
opkg install nano
opkg remove wpad-mini
opkg install wpad
nano /etc/config/wpa.conf

wpa.conf的具体内容,nano可以用ctrl+x触发保存

ctrl_interface=/var/run/wpa_supplicant
ap_scan=0
fast_reauth=1
network={
        key_mgmt=IEEE8021X
        eap=PEAP
        identity="身份信息"
        password="明文密码"
        phase1="peaplabel=0"
        phase2="auth=MSCHAPV2"
        eapol_flags=0
}
wpa_supplicant -D wired -i wan-c /etc/config/wpa.conf 

注意,用wan代替eth0,因为红米的wan/lan口公用了一个设备id。

接下来可以加入自启动脚本,或者按照参考链接里面增加启动任务即可。

总结: 通过刷入OpenWrt固件,红米AC2100将变成一个功能更强大、更可定制化的路由器。你可以享受到更好的性能、更多的选项和更高级的网络管理功能。但刷写固件有一定风险,请谨慎操作,并确保遵循相关指南和建议。

Rebind protection可能会导致域名解析受阻,可以根据需求关闭

docker搭建unblock-netease-music,解锁云音乐

在linux上直接用sudo docker-compose -f 下面文件.yml up -d即可;安卓(可能需要老一些的版本比如7.3.28)、ios、windows都可以直接解锁。不需要额外导入证书等操作

红字是需要注意或者变更的部分。

version: '3.1'

services:

  unblockmusic:
    container_name: unblockmusic
    image: pan93412/unblock-netease-music-enhanced
    restart: always
    ports:
      - 1082:8080
    command: "'-o' 'kugou' 'pyncmd' 'kuwo' 'bilibili' '-e' '-'"
    environment:
      - ENABLE_LOCAL_VIP=true
#      - NO_CACHE=true
      - ENABLE_FLAC=true
      - NODE_ENV=production
      - DISABLE_UPGRADE_CHECK=true
#      - SON_LOG=true
      - SELECT_MAX_BR=true
      - LOG_LEVEL=debug
    networks: #(可以删除下面所有代码)
      - "mynet" # HTTPS port
networks:
  mynet:
    external: true

openwrt ddns无法验证代理,用mixd-port会失败

openwrt的ddns-script验证mix-port会卡在代理验证上,本来以为是mixd-port问题,后来发现是openwrt的nc命令可能存在问题,这里给出一个workaround,绕过代理验证。

编辑dynamic_dns_functions.sh,直接修改 local __ERR=0 即可

nano /usr/lib/ddns/dynamic_dns_functions.sh

 # analyze and verify given proxy string
 # $1    Proxy-String to verify
 verify_proxy() {
         #       complete entry          user:password@host:port
         #                               inside user and password NO '@' of ":" allowed
         #       host and port only      host:port
         #       host only               host            ERROR unsupported
         #       IPv4 address instead of host    123.234.234.123
         #       IPv6 address instead of host    [xxxx:....:xxxx]        in square bracket
         local __TMP __HOST __PORT
         local __ERR=0 255 # last error buffer
         local __CNT=0   # error counter

         [ $# -ne 1 ] && write_log 12 "Error calling 'verify_proxy()' - wrong number of parameters"
         write_log 7 "Verify Proxy server 'http://$1'"

         # try to split user:password "@" host:port
         __TMP=$(echo $1 | awk -F "@" '{print $2}')
         # no "@" found - only host:port is given
         [ -z "$__TMP" ] && __TMP="$1"
         # now lets check for IPv6 address
         __HOST=$(echo $__TMP | grep -m 1 -o "$IPV6_REGEX")
         # IPv6 host address found read port
         if [ -n "$__HOST" ]; then
                 # IPv6 split at "]:"
                 __PORT=$(echo $__TMP | awk -F "]:" '{print $2}')
         else
                 __HOST=$(echo $__TMP | awk -F ":" '{print $1}')
                 __PORT=$(echo $__TMP | awk -F ":" '{print $2}')
         fi
         # No Port detected - EXITING
         [ -z "$__PORT" ] && {
                 [ -n "$LUCI_HELPER" ] && return 5
                 write_log 14 "Invalid Proxy server Error '5' - proxy port missing"
         }

         while [ $__ERR -gt 0 ]; do
                 verify_host_port "$__HOST" "$__PORT"
                 __ERR=$?
                 if [ -n "$LUCI_HELPER" ]; then  # no retry if called by LuCI helper script
                         return $__ERR
                 elif [ $__ERR -gt 0 -a $VERBOSE -gt 1 ]; then   # VERBOSE > 1 then NO retry
                         write_log 4 "Verify Proxy server '$1' failed - Verbose Mode: $VERBOSE - NO retry on error"
                         return $__ERR
                 elif [ $__ERR -gt 0 ]; then
                         __CNT=$(( $__CNT + 1 )) # increment error counter
                         # if error count > retry_count leave here
                         [ $retry_count -gt 0 -a $__CNT -gt $retry_count ] && \
                                 write_log 14 "Verify Proxy server '$1' failed after $retry_count retries"

                         write_log 4 "Verify Proxy server '$1' failed - retry $__CNT/$retry_count in $RETRY_SECONDS seconds"
                         sleep $RETRY_SECONDS &
                         PID_SLEEP=$!
                         wait $PID_SLEEP # enable trap-handler
                         PID_SLEEP=0
                 fi
         done
         return 0
 }

ubuntu升级到22.04lts

server端升级,可以先升级所有的软件

sudo apt-get update
sudo apt-get upgrade
#如果有部分依赖未解决,可以用aptitude解决
sudo aptitude upgrade

然后执行下列命令,不需要修改source.list

sudo do-release-upgrade

监控阿里云/服务器性能

最近阿里云经常卡住,ssh服务也无法访问,所以建了一个脚本监控cpu 内存 硬盘的读取情况,可以加到cron任务里面进行定期监控。

1、怀疑是云监控

2、怀疑是Debian系统和阿里云不兼容,同样的内容在腾讯云流畅运行

echo -e “\n################ $(date) ################”
echo “cpu”
ps -eo pid,comm,%cpu –sort=-%cpu | head -6
echo “mem”
ps -eo pid,comm,%mem –sort=-%mem | head -6
echo “io”
/usr/sbin/iotop -obP -n 1

卸载阿里云监控、云助手等

如果不删除阿里云助手,貌似会触发硬盘读写异常,当用控制台查看系统资源占用的时候

卸载阿里云盾

远程连接到阿里云云服务器或者轻量应用服务器后,执行以下代码卸载阿里云盾:

wget http://update.aegis.aliyun.com/download/uninstall.sh

chmod +x uninstall.sh

./uninstall.sh

wget http://update.aegis.aliyun.com/download/quartz_uninstall.sh

chmod +x quartz_uninstall.sh

./quartz_uninstall.sh

删除阿里云盾文件残留

卸载阿里云盾后,执行如下代码删除阿里云盾文件残留:

pkill aliyun-service

rm -fr /etc/init.d/agentwatch /usr/sbin/aliyun-service

rm -rf /usr/local/aegis*

最后检查下自己服务器上的阿里云盾是否卸载干净了,主要就是看进程里有没有阿里云盾的相关进程了(AliYunDun、aliyun-service和AliYunDunUpdate),可以通过ps -aux | grep -E ‘aliyun|AliYunDun’ 来检查,如果没有相关进程则说明阿里云盾已经卸载干净了。

卸载云监控

# 停止

/usr/local/cloudmonitor/cloudmonitorCtl.sh stop

# 卸载

/usr/local/cloudmonitor/cloudmonitorCtl.sh uninstall

rm -rf /usr/local/cloudmonitor

附上官方文档页面链接:

https://help.aliyun.com/document_detail/183482.htm?spm=a2c4g.38859.0.0.2cbdaf24YF96LF#task-1950491

卸载阿里云助手

https://help.aliyun.com/document_detail/134379.html

/usr/local/share/assist-daemon/assist_daemon --stop
/usr/local/share/assist-daemon/assist_daemon --delete
rm -rf /usr/local/share/assist-daemon


sudo dpkg -l
sudo dpkg -r aliyun-assist

jellyfin 列表显示文件名

下载一些音视频jellyfin不会显示文件名,而是显示内嵌的标题。官方没有提供支持,但是我们可以找一个折中的方法.

1、取消偏好内嵌标题

2、全选文件,右击-属性,然后编辑标题,可以先输入空格然后删除,然后点确定。

3、然后重新扫描即可。