win11迁移linux fedora 40 准备
<h1 id="懒人配置项目">懒人配置项目</h1><p>https://github.com/AClon314/profiles/blob/main/os_init/fedora-init.sh</p>
<h1 id="备份_day1">备份_day1</h1>
<center>
<p><img src="https://img2024.cnblogs.com/blog/1403997/202404/1403997-20240429165842952-1231739972.png" alt="压缩包备份" loading="lazy"></p>
</center>
用wiztree + 云盘
<h3 id="对于已经有一次压缩的不使用7z压缩">对于已经有一次压缩的,不使用<code>.7z</code>压缩</h3>
<p>我们都知道,一个个小文件传输会很慢,打包压缩最好。<br>
用wiztree挑出来,自己高度加工的信息(比如我纯100%手写的代码)、回忆、精品难以再次下载的文件。</p>
<p>高压缩:视频、iso等,使用.7z压缩,只能得到15%以下的二次压缩率(压缩不了多少大小),还慢<br>
但像src源码、文本,这种raw文件就可以考虑7z<br>
要考虑网络传输,不和谐,就用<code>7z</code>,因为有些可以在线解压<code>.zip</code></p>
<h3 id="打包带不走的列清单">打包带不走的,列清单</h3>
<pre><code>dir /b > mc_mods.txt
tree /f > mc_mods.txt
pnpm i -g @structure-codes/cli
struct -d -o mc_mods.txt
</code></pre>
<h3 id="校验完整性">校验完整性</h3>
<p>如果借用他人电脑,开网络共享,局域网传过去,可以校验下md5、sha256值是否一样<br>
局域网传输可参照:2台电脑通过网线传输文件<br>
小压缩包就看能否打开就行,都放u盘了</p>
<pre><code class="language-ps">Get-ChildItem . | Get-FileHash -Algorithm MD5 | Out-File -FilePath ./hash/hash.txt
</code></pre>
<h1 id="选择适合自己的发行版_day2">选择适合自己的发行版_day2</h1>
<p>不同发行版对不同硬件的电脑支持是不同的,最好自己实装后体验1小时。折腾了一整天,最后选择了Fedora+cinnamon。<br>
教训:尽量使用上游的、大集体维护的linux发行版。</p>
<ul>
<li>Fedora+Cinnamon桌面环境:大厂维护、较新内核(每半年更新一次)。注意cinnamon spin是社区维护版。选择它是因为:在我的拯救者游戏本上,没有我下面说的输入法、hybrid mode模式、wayland的问题。</li>
<li>Nobara:含有针对游戏本legion等的独特优化,自带nvidia驱动,开箱即用。有gnome/kde桌面环境版本</li>
<li>pop! os:自带nvidia驱动</li>
<li>mint:易用的驱动安装向导(包括nvidia)。更新更保守,可能跟不上最新硬件驱动。有Cinnamon/xfce/MATE桌面环境版本</li>
</ul>
<h1 id="安装_day3">安装_day3</h1>
<h2 id="u盘烧录">u盘烧录</h2>
<p>Ventoy,多引导,多启动</p>
<p>你可以在目录下放一个<code>.ventoyignore</code>空白文件,ventoy就不会扫描其子目录&文件了。</p>
<pre><code>F:.
│ WePE_64_V2.3.iso
│ Fedora-Workstation-Live-x86_64-40-1.14.iso
│ TangoPE自用修改版.iso
└───u
│ .ventoyignore
└───文档
</code></pre>
<p>我选pop os</p>
<h2 id="磁盘格式">磁盘格式</h2>
<p>linux对ntfs支持不好,微软没开源<br>
只读肯定可以,写就会有bug,于是需要把2块硬盘的数据全部转成<code>ext4</code>或<code>xfs</code><br>
个人文件都放/home,这样方便日后切换distro开发版。(就跟windows一定要分2个盘:c盘系统,d盘数据&程序)<br>
我有2块硬盘,大的装数据,小的装系统,这样大的就能挂载到wsl上共享</p>
<ul>
<li>xfs:首次分区后,无法二次分区<code>trim</code></li>
<li>ext4:稳定</li>
</ul>
<p>如果你还是很顾虑,建议多搜索,多看看评论区,每个人都可能遇到过不同的情况。<br>
https://www.youtube.com/watch?v=AhjL1SHku7M<br>
https://www.reddit.com/r/DataHoarder/comments/11ar65f/linux_filesystems_ext4_vs_xfs_what_to_choose_what/<br>
https://www.bilibili.com/video/BV1HT4m1S7wY<br>
https://discussion.fedoraproject.org/t/btrfs-vs-ext4-what-is-better/78292/8</p>
<blockquote>
<ul>
<li>XFS 非常适合在 SAN 上拥有不会出现故障的光盘的企业数据中心。XFS 速度很快,是大型数据集的不错选择。但是,如果下面的硬件坏了,XFS就会死掉。它从光盘故障中恢复很糟糕。从管理上讲,这是一个糟糕的选择,因为它不能缩小。</li>
<li>EXT4 更适合小文件和日常使用。XFS是更好的大文件和长期的维护和稳定性。</li>
</ul>
</blockquote>
<blockquote>
<ul>
<li>EXT 是可靠的、久经考验的、经过测试的和稳定的。它可以在死亡的光盘中幸存下来。日志非常好。对于大多数用途来说,它的速度很快。它扩展得很好。在管理上,它比 XFS 优越:可以使用 tune2fs 进行扩展、收缩和进行大量配置更改。</li>
<li>我之所以远离 XFS,是因为它还有另一个不好的行为:崩溃后,它会重播日志并愉快地继续。在几次崩溃之后,文件系统变得如此损坏,以至于日志的重放也失败了,fsck 也毫无用处。</li>
</ul>
</blockquote>
<p>考虑guest-windows的wsl2挂载linux磁盘可读写(一代wsl只能网络映射)<br>
https://www.bilibili.com/video/BV1tx421D7TJ/</p>
<h1 id="安装后配置_day4">安装后配置_day4</h1>
<h2 id="记下来更新grub的指令">记下来:更新grub的指令</h2>
<pre><code>sudo grub2-mkconfig -o /etc/grub2.cfg
</code></pre>
<p>https://gist.github.com/dbfin/6733294</p>
<h2 id="配置镜像源">配置镜像源</h2>
<h3 id="apt-getubuntu系列">apt-get(ubuntu系列)</h3>
<p>https://mirrors.tuna.tsinghua.edu.cn/help/ubuntu/<br>
pop os 是 ubuntu的衍生发行版,输入<code>cat /etc/issue</code>能查询到ubuntu的版本号</p>
<h3 id="dnffedora系列">dnf(fedora系列)</h3>
<p>https://mirror.tuna.tsinghua.edu.cn/help/fedora/</p>
<h3 id="flathub">flathub</h3>
<p>https://mirrors.sjtug.sjtu.edu.cn/docs/flathub<br>
https://zh.fedoracommunity.org/2020/05/13/try-on-flatpak-mainland-china-mirror.html</p>
<pre><code>export http_proxy='http://127.0.0.1:7897'
export https_proxy='http://127.0.0.1:7897'
/var/lib/flatpak/repo$ kate config
fedora:~/.var/app$ ls
com.microsoft.Edge
</code></pre>
<p>用户数据存储在 ~/.var/app 目录中。<br>
平台本身的配置位于 ~/.local/share/flatpak 目录中(系统级配置在 /var/lib/flatpak 目录中)。</p>
<h3 id="pip">pip</h3>
<p>https://mirrors.tuna.tsinghua.edu.cn/help/pypi/</p>
<details>
<summary>pop os</summary>
<h2 id="不使用独显启动qqedgechrome就会非常卡">不使用独显启动,qq、edge、chrome就会非常卡</h2>
<p>https://wiki.archlinux.org/title/Steam/Troubleshooting#No_context_menu_for_joining/inviting_friends<br>
原因在于我有2个屏幕,笔记本屏幕:AMD核显,外接显示器:nvidia独显<br>
于是,所有基于chromium webview的应用都会有这毛病:不使用独显启动,在外界显示器上会很卡。<br>
firefox没这毛病,可能有优化。但是firefox没有标签组功能,还是不好用。</p>
<p>拖拽窗口时自动切换gpu渲染。<br>
也许是pop os 的问题, nobara ok.</p>
</details>
<details>
<summary>Nobara</summary>
<h2 id="self-build-supergfx-for-kde-plasma-6">self build <code>superGFX</code> for kde plasma 6</h2>
<p>https://gitlab.com/Jhyub/supergfxctl-plasmoid<br>
author hasn't update <code>fedora build</code> to v2.0, just follow README.md to build.</p>
<h2 id="fix-ibus-pinyin仅nobara">fix ibus pinyin(仅nobara)</h2>
<pre><code>n@nobara-pc:~/.local/share/applications$ kate com.microsoft.Edge.desktop
</code></pre>
<pre><code>--enable-features=UseOzonePlatform,WaylandWindowDecorations --ozone-platform=wayland --ozone-platform-hint=auto --enable-wayland-ime
</code></pre>
<p>https://www.zhihu.com/question/648264411<br>
https://wiki.archlinuxcn.org/wiki/Fcitx5</p>
<p>the nobara pre-install ibus is broken, you need to <code>remove</code> then re-<code>install</code>.<br>
But all chrome would not compatible with any IME, except they are open with args <code>gtk4</code> in wayland<br>
https://fcitx-im.org/wiki/Using_Fcitx_5_on_Wayland#Chromium_.2F_Electron</p>
<p>https://forum.kde.org/viewtopic.php%3Ff=289&t=173694.html</p>
</details>
<h2 id="切换默认输入法为fcitx5_day4">切换默认输入法为fcitx5_day4</h2>
<pre><code class="language-bash">sudo dnf remove ibus
sudo dnf install fcitx5 -y # 只是需要一个im服务,所以装ibus或别的都可以
flatpak install org.fcitx.Fcitx5 org.fcitx.Fcitx5.Addon.Rime # you can install addon if you want
im-chooser # choose fcitx5
# flatpak --user override --socket=system-bus org.fcitx.Fcitx5
</code></pre>
<p>自行设置开机自启<br>
然后托盘右键,<code>配置</code>,添加键盘布局<code>中州韵</code><br>
调整字体大小:附加组件 经典用户界面 菜单字体 字号大小</p>
<blockquote>
<p>相关链接:<br>
fedora 使用DIY主题与rime-ice词库<br>
arch: https://blog.beautyyu.one/archlinux-gnome-chinese-input-fcitx5-rime-ice-solution<br>
fedora Fix: https://github.com/iDvel/rime-ice/issues/840 , https://flathub.org/apps/org.fcitx.Fcitx5<br>
https://www.reddit.com/r/flatpak/comments/t9hetq/how_do_i_remove_the_container_feature_from/<br>
云词库:https://github.com/hchunhui/librime-cloud</p>
</blockquote>
<h2 id="批量重命名nemo">批量重命名nemo</h2>
<p>https://github.com/qarmin/szyszka<br>
https://www.linuxlinks.com/best-free-open-source-gui-batch-renamers/</p>
<h2 id="实用工具">实用工具</h2>
<p>https://opentabletdriver.net/Wiki/Install/Linux<br>
snipaste<br>
copyQ</p>
<h2 id="appman--i-linuxqq"><s>appman -i linuxqq</s></h2>
<p>flatpak: QQ 每次注销后会提示“新设备重新扫码”,有github issue</p>
<h2 id="zsh--starship">zsh & starship</h2>
<pre><code>dnf install zsh
sudo lchsh $USER #/bin/zsh
logout
curl -sS https://starship.rs/install.sh | sh
</code></pre>
<h2 id="fsearch--fzf">fsearch & fzf</h2>
<p>https://www.cnblogs.com/yanghao2008/articles/13091714.html</p>
<h2 id="sudoedit--vscode">sudoedit = vscode</h2>
<p>貌似会报错,要手动配置--no-sandbox --user-profile-dir,以后再研究</p>
<pre><code>sudo update-alternatives --config editor
</code></pre>
<p>https://stackoverflow.com/questions/58980356/vscode-in-wsl-how-to-sudo-a-root-file-so-i-can-edit-it/77507776#77507776</p>
<h2 id="单独安装nvidia驱动">单独安装nvidia驱动</h2>
<h3 id="nvidia官方驱动">nvidia官方驱动</h3>
<p>https://rpmfusion.org/Howto/NVIDIA#Current_GeForce.2FQuadro.2FTesla</p>
<pre><code>sudo dnf update -y # '-y' to reboot if you are not on the latest kernel
sudo dnf install akmod-nvidia # rhel/centos users can use kmod-nvidia instead
sudo dnf install xorg-x11-drv-nvidia-cuda #optional for cuda/nvdec/nvenc support
modinfo -F version nvidia # wait a few seconds to run this line, should be 550.xx etc.
sudo dnf install radeontop
</code></pre>
<p>https://rpmfusion.org/Howto/Optimus<br>
nvidia-prime不在fedora可用,跳过安装。</p>
<h3 id="社区bumblebee逆向驱动">社区bumbleBee逆向驱动</h3>
<p>待补充</p>
<h2 id="拯救者linux驱动">拯救者linux驱动</h2>
<p>https://github.com/johnfanv2/LenovoLegionLinux<br>
我只用到“快充”模式、还有<code>开屏幕背面Y灯</code>、需要重启动的hybird mode切换</p>
<h2 id="省电">省电</h2>
<p>发现挂起只能待机7小时,优化前耗电17~21w,优化后能达到12w</p>
<h3 id="auto-cpufreq智能限制cpu频率">auto-cpufreq:智能限制cpu频率</h3>
<p>https://github.com/AdnanHodzic/auto-cpufreq?tab=readme-ov-file#auto-cpufreq-installer<br>
fedora建议还是用<code>auto-cpufreq-installer</code>安装,snap会有很多限制</p>
<h4 id="amd-cputurbo-is-controlled-by-amd-pstate-epp-driver">amd: CPUturbo is controlled by amd-pstate-epp driver</h4>
<p>https://github.com/AdnanHodzic/auto-cpufreq?tab=readme-ov-file#troubleshooting</p>
<h2 id="linux-虚拟机-独显直通_day5">linux 虚拟机 独显直通_day5</h2>
<p>最新内容移至:linux上模拟windows尝试</p>
<hr>
<p>https://wiki.archlinux.org/title/QEMU/Guest_graphics_acceleration<br>
https://github.com/ledisthebest/LEDs-single-gpu-passthrough/blob/main/README-cn.md</p>
<blockquote>
<p>bili视频评论区@撒盐的蛋炒饭:<br>
Ubuntu 直通成功!感谢up主的努力。<br>
intel CPU,NVDIA 显卡<br>
先按照up主的流程过一遍,你会发现很多步骤都是错的,走不通的,原因如下:</p>
<ol>
<li>系统不同、版本不同,所需的依赖项不同。所以你会发现很多依赖的软件你安装不了,那你就得<strong>找适合版本的平替,不要报错了硬装</strong>。</li>
<li>显卡直通部分,由于21年下旬后,很多显卡都开始从驱动到硬件均支持直通,所以根本<strong>不需要</strong>配置VBIOS、ROM,以及视频中相关的XML配置。只需要删掉KVM原先的显示相关配置,替换成显卡的PCI设备即可。</li>
<li>hooks目录下的文件配置好后,不要着急测试KVM,先把qemu中的虚拟机名称改成<code>test</code>,<strong>先确保KVM的各种功能运行正常,然后再配置显卡直通</strong>,最后将qemu的KVM名称改为虚拟机名称,进行你的第一次直通测试。</li>
<li>第一次直通由于显卡驱动没有装好,时间比较长,多等一会。等的适合能听到启动音,但没有画面,那是正常的,接着多等。保证网络正常,系统能帮你装驱动应该就行。(当然太久了的话,比如超过10分钟,可能真的是配置有问题)<br>
另外,up主的虚拟机配置也有很多是<strong>行不通</strong>的,比如磁盘、网络等都选Virt0,实际体验下来是不能正常读取、联网的。请务必根据自己的实际情况进行配置,很多时候虚拟机的<strong>默认属性配置就很好</strong>。</li>
</ol>
</blockquote>
<p>Looking glass,小白也能上手:https://looking-glass.io/<br>
分离独显,需核显+独显,更耗电:https://www.youtube.com/watch?v=g--fe8_kEcw<br>
PCI直通,但不能同时运行双系统:https://www.bilibili.com/video/BV1Er4y1i7pq ; https://www.bilibili.com/video/BV1KK4y1S7p2</p>
<p><strong>优先实现省电的方案:切换双系统,笔记本插上电再用核显+独显:同时运行双系统</strong></p>
<blockquote>
<p>基于KVM的虚拟显卡透传技术<br>
Windows Inside of Linux<br>
The Ultimate System - GPU Passthrough with Looking Glass</p>
</blockquote>
<h3 id="bdsdxe-failed-to-load-boot0001-uefi-qemu-dvd-rom-access-denied">bdsdxe: failed to load boot0001 uefi qemu dvd-rom, access denied</h3>
<p>禁用虚拟机内的secore boot<br>
https://forum.proxmox.com/threads/access-denied-for-the-cd-rom.117720/</p>
<h2 id="cinnamon">cinnamon</h2>
<h3 id="applet">applet</h3>
<ul>
<li>drawer</li>
</ul>
<h3 id="plugin">plugin</h3>
<p>。。。</p>
<h2 id="关闭selinux">关闭selinux?</h2>
<pre><code>setenforce 0
</code></pre>
<p>https://www.reddit.com/r/Fedora/comments/zny79j/what_makes_disabling_selinux_a_big_deal/<br>
https://www.cnblogs.com/yqzc/p/12361784.html</p>
<h2 id="bugs">bugs</h2>
<ul>
<li>logout后numLock触发beep,需要<code>dnf install numlockx</code>,然后在设置、登录界面打开numlockx</li>
</ul>
<h2 id="memreduct">memreduct</h2>
<p>https://gist.github.com/harssh/8ccb9ae8fb12ea6df697</p>
<h2 id="porton-ge">Porton-GE</h2>
<p>https://gist.github.com/GloriousEggroll?page=1</p>
<h2 id="newbing">newBing</h2>
<p>https://github.com/jiarandiana0307/patch-edge-copilot?tab=readme-ov-file<br>
https://zhuanlan.zhihu.com/p/673914163<br>
<code>edge://profile-internals/</code>,设为只读</p>
<h2 id="草稿">草稿</h2>
<p>https://github.com/Nobara-Project/nobara-core-packages<br>
appimage pool<br>
避免使用flatpak:沙盒导致空间占用巨大,20GB</p>
<h1 id="放弃">放弃</h1>
<p>最后发现 https://www.atzlinux.com/allpackages.htm<br>
国内软件优先支持debian系的linux,redhat的fedora rpm包少得可怜,特别是fcitx5库缺失的一些问题……<br>
详见新文章:迁移kubuntu 24</p>
<h1 id="2个月后格式化">2个月后:格式化</h1>
<p>再见了NTFS。<br>
<img src="https://img2024.cnblogs.com/blog/1403997/202406/1403997-20240617130410389-1410867528.png" alt="image" loading="lazy"></p><br><br>
来源:https://www.cnblogs.com/nolca/p/18164633
頁:
[1]