2023-09-18

Ubuntu/Linux Mint在 Macbook 13" 2014 的無線網卡/麥克風/風扇/攝影機設定

0.無線網卡:
因為broadcom的網卡driver不是開源而是專有的,所以用以下指令自動安裝(如nvidia driver也是):
sudo ubuntu-drivers autoinstall

1.修正line-in麥克風:
找到 mbp 2014 13"的機型識別碼:MacBookPro11,1

再找到 driver 為 Cirrus Logic CS4208 = mbp11

修改  /etc/modprobe.d/alsa-base.conf ,新增:
options snd-hda-intel model=mbp11

2.修正風扇不正常問題:
sudo apt install mbpfan
sudo systemctl status mbpfan

避免風扇時不時狂轉,修改/etc/mbpfan.conf:
min_fan1_speed = 2000
max_fan1_speed = 3500
...
polling_interval = 5

3.修正facetime webcam:

如果是iSight鏡頭(通常是2005~2010的macbook,如果不是請略過):
下載文章附件的AppleUSBVideoSupport,解壓縮:
https://www.linux.org/threads/installing-linux-on-an-imac.26009/
sudo apt install isight-firmware-tools
指向剛剛的AppleUSBVideoSupport檔案

安裝facetime camera firmware:
sudo apt install curl xzcat cpio git
git clone https://github.com/patjak/facetimehd-firmware.git
cd facetimehd-firmware
make
sudo make install

安裝facetime camera driver:
git clone https://github.com/patjak/bcwc_pcie.git
apt install debhelper dkms
mkdir /usr/src/facetimehd-0.1
cd bcwc_pcie
cp -r * /usr/src/facetimehd-0.1/
cd /usr/src/facetimehd-0.1/
make clean
dkms add -m facetimehd -v 0.1
dkms build -m facetimehd -v 0.1
dkms mkdsc -m facetimehd -v 0.1 --source-only
dkms mkdeb -m facetimehd -v 0.1 --source-only
cp /var/lib/dkms/facetimehd/0.1/deb/facetimehd-dkms_0.1_all.deb /root/
rm -r /var/lib/dkms/facetimehd/
dpkg -i /root/facetimehd-dkms_0.1_all.deb

ref:
https://askubuntu.com/questions/1430547/webcam-not-working-in-ubuntu-22-04-on-macbook-air
https://github.com/patjak/facetimehd/wiki/Installation#get-started-on-debian
https://github.com/linux-on-mac
https://support.apple.com/zh-tw/HT201300
https://askubuntu.com/questions/984239/no-microphone-picked-up-on-ubuntu-16-04-on-macbook-pro
https://www.kernel.org/doc/html/latest/sound/hd-audio/models.html

2023-08-28

openshift 4.8 安裝後調整

一.新增自動上 letsencrypt 功能:

這樣以後在router加個annotation ->  kubernetes.io/tls-acme : true 就會自動上letsencrypt憑證了。
參考:
https://developer.ibm.com/tutorials/secure-red-hat-openshift-routes-with-lets-encrypt/
https://github.com/tnozicka/openshift-acme/tree/master/deploy#cluster-wide
https://www.redhat.com/en/blog/dynamic-ssl-certificates-using-letsencrypt-openshift

就算不是cluster admin,也可以在自已的專案內使用,比較麻煩的就是每個專案都要佈署進去一次,這裡採的是用cluster wide的方法,必須是cluster admin才行,這樣後以每個使用者就不用自已再做一次,直接上annotation就行。

做法(使用cluster admin):
1.用cluster admin -> oc login
2.執行以下命令:

$ oc new-project acme-operator
$ oc apply -fhttps://raw.githubusercontent.com/tnozicka/openshift-acme/master/deploy/single-namespace/{role,serviceaccount,issuer-letsencrypt-live,deployment}.yaml
$ oc create rolebinding openshift-acme --role=openshift-acme --serviceaccount="$( oc project -q ):openshift-acme" --dry-run -o yaml | oc apply -f -


二.設定default sotrage class:

這樣以後佈署服務時,有掛volume的話,就不用再手動指定storage class,而會自動使用預設的storage class,否則之前都要手動改PVC的yml去指定:
$ sed -i '/spec:/a\  storageClassName: managed-nfs-storage' configs/*-persistentvolumeclaim.yaml

參考
https://www.goglides.dev/bkpandey/how-to-configure-default-storage-class-in-openshift-2oj4

$oc patch storageclass managed-nfs-storage -p '{"metadata": {"annotations": {"storageclass.kubernetes.io/is-default-class": "true"}}}'


三.掛載 image registry 的 PV (persistent volume):

預設佈署完 OCP內建的 image registry是沒有作用的,因為沒有指定PV(persistent volume)給他,這樣一些功能是無法正常使用的,譬如build config (在OCP上build image),這包含了S2I (source to image)及build from dockerfile等功能,因此要先給他一個PV才能正常運作。

參考
https://www.ibm.com/docs/zh-tw/mas-cd/continuous-delivery?topic=requirements-enabling-openshift-internal-image-registry
https://access.redhat.com/documentation/en-us/openshift_container_platform/4.3/html/registry/setting-up-and-configuring-the-registry#registry-configuring-storage-baremetal_configuring-registry-storage-baremetal
https://access.redhat.com/documentation/en-us/red_hat_openshift_container_storage/4.2/html-single/managing_openshift_container_storage/index#configuring-image-registry-to-use-openshift-container-storage_rhocs

假設要掛到某個名稱為managed-nfs-storage的storage class,因為是nfs,所以要先確認nfs server上的mount option有no_wdelay 還有 root_squash (但root_squash我沒有加就是了):

# cat /etc/exports
/mnt/data *(rw,sync,no_wdelay,root_squash,insecure,fsid=0)
# systemctl restart nfs-server

再下指令:

$ oc project openshift-image-registry

$ oc create -f <(echo '{
   "apiVersion": "v1",
   "kind": "PersistentVolumeClaim",
   "metadata": {
     "name": "image-registry-storage"
   },
   "spec": {
     "storageClassName": "managed-nfs-storage",
     "accessModes": [ "ReadWriteMany" ],
     "resources": {
       "requests": { "storage": "100Gi"
     }
   }
 }
}');

================

$ oc edit configs.imageregistry.operator.openshift.io -n openshift-image-registry

======== 手動修改 ========

spec:

    managementState: Managed

storage:

      pvc:

        claim: image-registry-storage

========================

$ oc get co image-registry

===================================================

也有把PVC先掛到暫存空間的方法,但是不建議用在production的服務上:
https://serverfault.com/questions/1082295/how-to-enable-local-image-registry-on-openshift-single-node-cluster-installation

.........
  managementState: Managed
..........
  replica: 1
...........
  storage:
    emptyDir: {}

==================

之後看要不要把image registry公開到網路上(也就是建立一個route),可以用預設的DefaultRoute或是自已手動建一個route:
https://access.redhat.com/documentation/en-us/openshift_container_platform/4.8/html/registry/securing-exposing-registry

然後讓要可以登入的使用者新增role:
https://access.redhat.com/documentation/en-us/openshift_container_platform/4.8/html/registry/accessing-the-registry#prerequisites

$ oc project openshift-image-registry
$ oc policy add-role-to-user registry-viewer <user_name>
$ oc policy add-role-to-user registry-editor <user_name>

之後登入(用docker或podman都行)

$ oc whoami -t #先取得登入token,注意不是直接打使用者密碼登入!
$ podman login image-registry.your-opensfhit.domain
Username:<username>
Password:<剛取得的 token>

四.將ingress operator的default controller改用proxy protocol (haproxy也要同時修改):

這樣的好處是pod服務內的程式不但可以從X-Forward-For抓到真實的來源IP,也可以在router下annotation做IP的白名單whitelist,真的是太方便了!

參考:
https://docs.openshift.com/container-platform/4.8/networking/ingress-operator.html#nw-ingress-controller-configuration-proxy-protocol_configuring-ingress
https://www.haproxy.com/documentation/hapee/latest/load-balancing/client-ip-preservation/enable-proxy-protocol/

指令:
$ oc -n openshift-ingress-operator edit ingresscontroller/default

找到最上層的spec (注意不要加到status去了),加入:

  spec:
    endpointPublishingStrategy:
      hostNetwork:
        protocol: PROXY
      type: HostNetwork

再到 haproxy 的機器,修改 /etc/haproxy/haproxy.cfg,在 listen 或 backend 端的80, 443的server instruction加入send-proxy,mode tcp不用動,這樣就會以proxy protocol溝通(也就是每個連線會加入proxy協定自已的特殊header):

listen ingress-router-443
  bind *:443
  mode tcp
  balance source
  server worker0 worker0.example.com:443 check inter 1s send-proxy
  server worker1 worker1.example.com:443 check inter 1s send-proxy
  server worker2 worker2.example.com:443 check inter 1s send-proxy

接下來可以佈署一個簡單的網頁服務,印出header看看有沒有X-Forwarded-For帶真實IP。

router做白名單的方法:

https://docs.openshift.com/container-platform/4.8/networking/routes/route-configuration.html#nw-route-specific-annotations_route-configuration

在要限制IP的router加入annotation(IP或網段都可以,用space隔開):
haproxy.router.openshift.io/ip_whitelist:  168.85.1.1 203.22.5.0/8

================================

另外關於佈署服務:

一、imagePullPolicy

https://docs.openshift.com/container-platform/4.8/openshift_images/managing_images/image-pull-policy.html

規則如下:

If the tag is latest, OpenShift Container Platform defaults imagePullPolicy to Always.
Otherwise, OpenShift Container Platform defaults imagePullPolicy to IfNotPresent.

但是呢,實際上並不是這麼回事,即使image的tag是latest,他還是不會自動拉新的image,還是會一直使用cache裡面的,真的很困擾,因此每次佈署時,最好手動改一下deploy檔:

$ sed -i '/\          image:/a\          imagePullPolicy: Always' configs/*-deployment.yaml

二、kompose轉換為opensfhit的佈署檔而不是k8s

kompose convert加參數--provider openshift並用 oc apply -f 佈署

https://kubernetes.io/docs/tasks/configure-pod-container/translate-compose-kubernetes/#openshift-kompose-convert-example

但實際上用會有些轉不太完整,

如image stream的設定檔*.imagestream.yaml要手動加 spec.tag.name(image的tag號,應該是bug)

不支援docker compose file的 extra_hosts 參數,得要自已在*.deploymentconfig.yaml的spec.template.spec 手動加:

hostAliases:
        - ip: "100.1.2.3"
          hostnames:
          - "myhost.domain.com"


反而不加--provider openshift參數並改用 kubectl apply -f 倒是沒啥問題...


三、讓container集中在一個pod,而不是一個container就一個pod

可以在kompose convert加參數 --multiple-container-mode 試試

https://github.com/kubernetes/kompose/pull/1394?source=post_page-----20ce5313be1e--------------------------------

四、關於pod運行時的一些權限問題

https://ithelp.ithome.com.tw/articles/10243781

由於OCP對容器的限制比k8s嚴格,不准容器內直接用root(uid= 0 或 root)去執行,而是會隨機給一個UID,但給予的GID是屬於root group的(gid= 0 或 root),因此寫dockerfile時,最好把會動到的目錄(如寫入log 或 tmp 或安裝 plugin檔等的目錄,就是有可能寫入或動到檔案的地方):

RUN chgrp -R 0 /some/directory \
  && chmod -R g+rwX /some/directory

docker compose file的service 可以加入user來指定使用者跟群組:
https://docs.docker.com/compose/compose-file/05-services/#user
如在service下面指定
user: 0:0

user: root:root
但這在 openshift 是沒用的,因為就是不允許 root 去跑...

那如果硬要使用image預設指定的user去跑呢?那就要先在專案建一個SA(service account),再把anyuid這個scc policy指定給SA,然後在專案config寫入指定SA:

#用 admin 執行 (一次就好)
oc project my-project
oc create sa my-sa
oc adm policy add-scc-to-user anyuid -z my-sa

#用 user 執行patch (每次重deploy都要)
oc patch dc gitlab -p '{"spec":{"template":{"spec":{"serviceAccountName": "gitlab-sa"}}}}'

#或手動加到deploymentconfig.yaml (每次重deploy都要)

spec:
  template:
    spec:
      serviceAccountName: my-sa

五、關於 coredns 查詢dns時的問題

用以下指令,可發現 cluster的dns ip 固定為 172.30.0.10:
oc get svc -n openshift-dns dns-default -o wide

用172.30.0.10去查,有時會出現 "truncated, retrying in tcp mode":
dig xxx.test.domain @172.30.0.10
nslookup xxx.test.domain 172.30.0.10

再根據以下二篇文章說明,可知dns查詢時,若是回傳的資訊量太大(>512),可能就會由UDP查詢變為TCP查詢,因此會出現 "truncated, retrying in tcp mode"是正常的,不是壞掉:
https://bugzilla.redhat.com/show_bug.cgi?id=2043046#c3
https://bugzilla.redhat.com/show_bug.cgi?id=2062307#c14

因此去檢查upstream的dns server時,發現 53/TCP 竟然沒監聽,只剩下 53/UDP,因此把bind給重啟就好了,只是怎麼會掛掉…蠻神奇的。

六、Ingress Controller 數量不夠的問題

參照:
https://access.redhat.com/discussions/5490621#comment-2288691
https://access.redhat.com/documentation/zh-tw/openshift_container_platform/4.5/html/networking/configuring-ingress-controller#nw-ingress-controller-configuration_configuring-ingress

單位的openshift平台配置了六個node,master x 3(作為api的管理pod用),worker x 3(作為使用者專案產生的pod運行)。


某天查haproxy的log時,發現有以下訊息:
localhost haproxy[3679]: Server ingress-router-80/worker0 is DOWN, reason: Layer4 connection problem, info: "Connection refused", check duration: 0ms. 2 active and 0 backup servers left. 0 sessions active, 0 requeued, 0 remaining in queue.

表示worker0的haproxy(也是就ingress controller)沒在跑,因此80/443都被refused,netstate去檢查80/443也沒有程式在監聽,用以下指令查目前的ingress controller的replicas數量:

$ oc get -n openshift-ingress-operator ingresscontrollers/default -o jsonpath='{$.status.availableReplicas}'

發現數量只有2,但有3台worker,數量當然不夠,因此增加replica的數量:

$ oc patch -n openshift-ingress-operator ingresscontroller/default --patch '{"spec":{"replicas": 3}}' --type=merge

設定haproxy log的方法:https://linuxconfig.org/install-and-configure-haproxy-on-redhat-8



2023-02-14

在macbook pro M1安裝Ubuntu 22.04

在macbook pro M1的UTM安裝Ubuntu arm版很簡單,照下列一步步安裝即可:
https://docs.getutm.app/guides/ubuntu/

官方的教學是安裝server版再安裝ubuntu-desktop,
若需要直接安裝有桌面的ubuntu arm版,可在下面下載:
https://cdimage.ubuntu.com/jammy/daily-live/current/

有個比較需要注意的是utm的模擬顯示卡,及x11跟wayland的問題,
在ubntu登入畫面點擊姓名,再點擊右下角的齒輪,
可選擇gdm3 session使用X11或wayland登入,但因utm的顯卡模擬有些還是有bug,
如顯卡模擬選項有gpu support的(如virtio-ramfb-gl),選擇x11或wayland登入時,可能造成某些軟體視窗打不開或一片黑,若遇到問題先不要選有gpu support的,選virtio-ramfb就好,這樣用x11就比較不會有問題(或有的用wayland沒問題,切換試試)。或更新utm看看能不能解決。

2023-02-12

RK987在Linux/Ubuntu下模擬成Apple鍵盤造成Function keys不正常的問題

 二年多前在淘寶買的RK987藍芽雙模鍵盤,在Linux/Ubuntu下的F1-F12總是會模擬成多媒體鍵(不管有無加上Fn),用lsusb指令查看,發現這鍵盤的vid:pid是05ac:024f,名稱是Apple Keyboard,才發現這鍵盤把自已假裝成Apple鍵盤了,這導致Linux會自動載入hid_apple驅動,但這鍵盤的F1-F12卻又無法正常使用。

解法是修改Fn的預設行為:

echo "options hid_apple fnmode=2" | sudo tee -a /etc/modprobe.d/hid_apple.conf 
sudo update-initramfs -u <for Ubntu/Debain>
sudo mkinitcpio -P <for Arch>

並將鍵盤模式用Fn+A切換成WIN模式。

下面解釋了Fn設為0,1,2的不同:

  1. 0 = disabled : Disable the 'fn' key. Pressing 'fn'+'F8' will behave like you only press 'F8'
  2. 1 = fkeyslast : Function keys are used as last key. Pressing 'F8' key will act as a special key. Pressing 'fn'+'F8' will behave like a F8.
  3. 2 = fkeysfirst : Function keys are used as first key. Pressing 'F8' key will behave like a F8. Pressing 'fn'+'F8' will act as special key (play/pause).

ref:
https://unix.stackexchange.com/questions/604791/keyboard-function-keys-always-trigger-media-shortcuts-regardless-of-whether-fn
https://unix.stackexchange.com/questions/121395/on-an-apple-keyboard-under-linux-how-do-i-make-the-function-keys-work-without-t
https://unix.stackexchange.com/a/672672

2023-01-18

酷比魔方GT BOOk 13(ALLDOCUBE i1305)安裝Linux Mint 22.1

 以下僅列幾個安裝linux mint/ubuntu時的注意事項:

1.由於購買時選的是無風扇的版本(有出帶風扇版本,但電池變小,風扇並沒搭配熱導管,就只是抽風而已沒啥用,而且還比較貴),因此買了相變導熱片PTM7950跟Laird導熱硅脂墊片2mm來改裝CPU散熱,實際可壓到15W沒問題。

2. bios關閉tpm跟secure boot,graphic的部份把數字都調到最大。修改 /etc/default/grub,加入:
GRUB_DEFAULT=saved
GRUB_SAVEDEFAULT=true
#GRUB_TIMEOUT_STYLE=hidden
GRUB_TIMEOUT=3
GRUB_GFXMODE=1600x1200
GRUB_GFXPAYLOAD_LINUX=keep

3.網卡是realtek rtl8821ce,請不要用rtl8821ce-dkms的驅動,直接改用5.19以上的kernel即可,否則用dkms驅動非常之不穩且訊號也不太好,修改 /etc/NetworkManager/conf.d/default-wifi-powersave-on.conf,將 wifi.powersave = 3 改為 wifi.powersave = 2 以關閉wifi省電避免掉線。

可用 iwconfig 查看 Power Management 是不是確定為off。

4.可用 https://github.com/georgewhewell/undervolt 調整 PL1 及 PL2 (參數為-p1, -p2)解TDP上限,可設為-p1 6 30 -p2 15 1,官方TL2到20W,只設到15W是怕被動散熱壓不住。
或用
https://slimbook.es/en/tutoriales/aplicaciones-slimbook/514-en-slimbook-intel-controller
但要修改 /home/<user>/.config/slimboookintelcontroller/slimbookintelcontroller.conf,加入:
n-5100 = /6@8/6@10/8@12/ 6/10/15 w

再修改 /usr/share/slimbookintelcontroller/src/utils.py,找到
patron = re.compile(r"[ ](\w\d)[-]([0-9]{4,5})(\w*)"),改為:

if cpu.find("Intel") != -1:
            #patron = re.compile(r"[ ](\w\d)[-]([0-9]{4,5})(\w*)")
            #version = patron.search(cpu).group(1)
            #number = patron.search(cpu).group(2)
            #line_suffix = patron.search(cpu).group(3)
            #model_cpu = version + "-" + number + line_suffix
            #return cpu, model_cpu, version, number, line_suffix
            return "Intel N5100", "N5100", "N", "5100", ""

省電控制也可使用 https://slimbook.es/en/tutoriales/aplicaciones-slimbook/520-slimbook-battery-4-application-to-optimize-your-laptop-s-battery
但因這台筆電的電池回傳資訊有缺少電池種類(technology),故要修改程式碼,打開
/usr/share/slimbookbattery/src/slimbookbatterypreferences.py
約539行(battery_data = {}),改為:

        battery_data = {'technology':'lithium-polymer',
                'time to empty':'6.0 hours',
                'time to full':'0.0 hours'}

這樣程式才能正確執行並儲存修改。

5.螢幕的亮度快捷鍵(Fn+F6/F7)無法作用,目前還沒找到解法,先暫時用工具列的電源圖示去調整,或者在系統設定的「鍵盤/快捷鍵鉏合/系統/硬體」裡自訂調整螢幕亮度的快捷鍵(我是設為win + F6/F7)。
可下載ICC描述檔校正螢幕顏色:
https://www.notebookcheck.net/uploads/tx_nbc2/VVX14P048M00.icm

6.觸控版(SYNA3602:00 0911:5288 Touchpad)可二三四多點觸控,可安裝
https://github.com/bulletmark/libinput-gestures
支援手勢。下邊有左中右鍵,滑的手感不太好。

7.安裝lutris時,官方文件是說要裝最新驅動:
https://github.com/lutris/docs/blob/master/InstallingDrivers.md#amd--intel
但實際上照這指令先加ppa再安裝可能會找到不對應的安裝包,因此指令中加PPA的部份先不要執行,等安裝完再加入PPA然後再更新。若不小心已先安裝,用「更新管理員/軟體來源/維護」的「降級外來軟體包」,把來源為kiask的包先降級為官方包=>移除kiask ppa=>重裝lutris=>安裝
sudo dpkg --add-architecture i386 && sudo apt update && sudo apt upgrade && sudo apt install libgl1-mesa-dri:i386 mesa-vulkan-drivers mesa-vulkan-drivers:i386

sudo add-apt-repository ppa:kisak/kisak-mesa & sudo apt update & sudo apt upgrade
特別注意的是kiask這個PPA有時會造成更新管理員出錯卡住,此時可執行「軟體來源」把這個ppa先拿掉再更新。

8.chromium的硬體加速一直無法搞定,不管怎麼修改環境變數為LIBVA_DRIVER_NAME=iHD,都一樣只吃i965_drv_video.so而不吃iHD_drv_video.so,可能chromium及i965驅動二者都有問題(UHD核顯太新嗎?),改使用firefox則妥妥的(https://wiki.archlinux.org/title/firefox)。
可安裝intel-gpu-tools,使用intel_gpu_top看是否有吃到gpu,並安裝enhanced-h264ify把VP8及AV1擋掉。
記得11代CPU(Jasper Lake)的UHD核顯要裝 intel-media-va-driver-non-free 及 i965-va-driver-shaders
支援的codec: https://www.intel.com/content/www/us/en/develop/documentation/media-capabilities-of-intel-hardware/top.html#media-capabilities-supported-by-intel-hardware_codecs-decode-support-for-11th-and-12th-generation-intel-core-processors
(但vainfo並沒顯示有支援av1跟vp8,可能是intel的驅動又沒有加了...)

9. mint 21 (ubuntu 22)的network manager可以直接加wireguard的vpn了,但非常難用,因為是以虛擬網卡的方式使用,還是改用令令列 wireguard 吧,或者用一些免費的gui:
https://github.com/UnnoTed/wireguird
https://github.com/Devsfy/wiregui
設定cisco vpn時,一直無法儲存,結果是tunnel interface name一定要設,以前是不用的,所以隨便打個1就行。
設定l2tp vpn時,一直無法連線成功,結果是PPP Settings裡的「允許下列驗證方法」,這裡面「千萬」不要取消任何的勾選,直接勾「使用點對點加密」及「允許可設定狀態加密」即可,讓程式自動去取消勾選。

10. fcitx5的可安裝以下DEB加入額外輸入法(嘸蝦米、倉頡等),不要用官方的:
https://github.com/duckfly-tw/fcitx5-extra-tables-deb/releases/tag/v1

2023-01-04

Linux Lutris 安裝 Battle.net 及 World of Warcraft (WOW)

安裝過程中遇到了一些雷,把解決過程順便紀錄下來。
  1. 從lutris按左上的+號,找尋lutris上的遊戲,找battle.net並安裝,安裝時可參考https://github.com/lutris/docs/blob/master/Battle.Net.md
    https://github.com/lutris/docs/blob/master/InstallingDrivers.md

  2. 因預設用的wine版本是lutris-7.2-2-x86_64,啟動battle.net介面時會直接噴錯,中間有改用wine 8.0 staging試,可以進battle.net安裝WOW,但會一直卡更新(初始化 2145571...)

  3. 安裝ProtonUp-Qt,幫lutris安裝GE的proton7-35版本,並在lutris設定battle.net的wine版本為此版本,順便設定啟用DPI縮放

  4. 此時開啟battle.net應可正常登入並下載WOW,在battle.net設定把限制下載頻寬關閉。若仍無法正常下載或更新,請繼續以下步驟

  5. 設定battle.net的winetricks,安裝vcrun2015及corefonts

  6. 開linux terminal並進安裝battle.net的資料夾(假設放在/home/<user>/Games/battlenet/),找到
    /home/<user>/Games/battlenet/drive_c/Program Files (x86)/Battle.net
    /home/<user>/Games/battlenet/drive_c/ProgramData/Battle.net
    這二個資料夾,分別在這二個資料夾下執行:
    find -exec setfattr -x user.DOSATTRIB {} \;

    並再到/home/<user>/Games/battlenet/drive_c/Program Files (x86)/Battle.net/Battle.net.13894執行:
    setfattr -x user.DOSATTRIB platforms/qwindows.dll

  7. 有些比較舊的顯卡(我有在一台只有內顯Intel HD Graphics 520的筆電試裝),VULKAN的支援度可能沒那麼好,若遊戲無法執行或噴錯,可以試著分別關閉VXDK或VXD3D試試,用的是intel i915系列driver的話(如上述顯卡)再執行:
    sudo sysctl dev.i915.perf_stream_paranoid=0

  8. 另外開啟lutris的log會發現一直無法載入32bit的gamemode library,可參考以下解法:
    https://github.com/FeralInteractive/gamemode/issues/254#issuecomment-643648779

ref:
https://www.linuxuprising.com/2021/11/easily-install-and-manage-custom-wine.html
https://appdb.winehq.org/objectManager.php?sClass=version&iId=28855
https://us.forums.blizzard.com/en/blizzard/t/last-update-completely-breaks-wine-compatibility/33122
https://lutris.net/games/battlenet/
https://github.com/lutris/docs/blob/master/Battle.Net.md
https://github.com/lutris/docs/blob/master/InstallingDrivers.md
https://www.reddit.com/r/wow/comments/zfrkpd/stuck_initializing_2145571/
https://github.com/FeralInteractive/gamemode/issues/254

2022-12-28

在Rocky9使用openssl_sign及openssl_verify失敗的原因

 

在Rocky 9 (RHEL 9),一些已被認為不安全的cipher suites 及 protocols預設是停用的,

因此像在php8使用openssl_sign或openssl_verify,若不加第四個參數,預設都是用不安全的OPENSSL_ALGO_SHA1,因此會簽章或驗證失敗,但從錯誤訊息(-1)是看不出原因的(openssl_verify 來說,1=驗證成功,0=驗證失敗,-1/false=發生錯誤)。

還有使用ssh連線到別台主機時,可能別台主機還是用舊的sha1簽章,因此連線交握過程會失敗。

若在Rocky 9(RHEL 9)要啟用不安全的湊雜及加密演算法,必須下指令:
update-crypto-policies --set LEGACY

update-crypto-policies --set DEFAULT:SHA1 #只增加SHA1

以上指令會修改以下檔案(其實還會修改其它backend設定檔,如java/openssh/nss/gnutls等,以下單指openssl):
/etc/pki/tls/openssl.cnf:
[ crypto_policy ]
.include = /etc/crypto-policies/back-ends/opensslcnf.config

/etc/crypto-policies/back-ends/opensslcnf.config
[evp_properties]
rh-allow-sha1-signatures = yes

openssl-libs所包含的設定檔:
dnf repoquery -l openssl-libs | grep etc

ref:
https://bugs.launchpad.net/ubuntu/+source/crypto-policies/+bug/1926664/comments/6
https://gitlab.com/redhat-crypto/fedora-crypto-policies
https://forums.rockylinux.org/t/php-8-0-13-openssl-verify-fails-on-rocky-9/7478
https://github.com/php/php-src/issues/9686
https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html/security_hardening/using-the-system-wide-cryptographic-policies_security-hardening
https://www.redhat.com/en/blog/rhel-security-sha-1-package-signatures-distrusted-rhel-9