ubuntu22.04升级ubuntu24.04的一些问题记录

m0_2640961343 2024-10-13 17:07:01 阅读 82

文章主要用于对ubuntu22.04升级到ubuntu24.04后的一些问题记录。

升级过程中,一些配置文件我全都选择的<code>替换为新的配置文件(怕配置有修改导致故障),意味着原来的配置修改没有了。

ubuntu22.04使用的是GNOME42,而ubuntu24.04使用的是GNOME46

➜ ~ uname -a

Linux hcsci-ThinkPad-E15-Gen-4 6.8.0-44-generic #44-Ubuntu SMP PREEMPT_DYNAMIC Tue Aug 13 13:35:26 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux

1.windows11远程登录问题

远程设置

再重新设置一下<code>密码和密钥中的登录密码:

在这里插入图片描述

详细步骤参考Windows远程登录Ubuntu22.04方式记录。

在Windows中,<code>Win+R后输入mstsc,输入ubuntu的IP地址,点击连接,输入ubuntu系统桌面共享设置中登录详情内的用户名密码即可。

参考文章:ubuntu24.04设置远程桌面

2.笔记本关盖后休眠问题

之前ubuntu22.04时,使用的优化软件来禁用休眠。

更新到ubuntu24.04后,该功能没有了。所以只能手动修改配置文件。

1.设置息屏从不

在这里插入图片描述

编辑<code>/etc/systemd/logind.conf:

sudo vim /etc/systemd/logind.conf

在这里插入图片描述

新增行<code>HandleLidSwitch=ignore或者修改#HandleLidSwitch=suspend行,取消注释,改suspendignore

选择其中一种就可以。

注销重启生效。

参考文章:ubuntu 24.04 系统优化,解决笔记本电脑合盖后休眠、desktop/桌面文件夹内的文件无法显示在桌面上的问题

3.dotnet8.0

系统升级后,sudo apt autoremove命令将之前的dotnet给自动卸载了。

参考如何在 Ubuntu 24.04 上安装 .NET 8.0 ? 重装。

备份一下步骤:

# 确保你的系统是最新

sudo apt update

sudo apt upgrade -y

# 安装.NET需要的额外的软件

sudo apt install -y apt-transport-https ca-certificates gnupg

# 添加 Microsoft 包存储库

wget https://packages.microsoft.com/config/ubuntu/24.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb

# 安装下载的包

sudo dpkg -i packages-microsoft-prod.deb

# 再次更新包索引

sudo apt update

# 安装 .NET SDK

sudo apt install -y dotnet-sdk-8.0

# 验证安装的版本

dotnet --version

验证结果:

➜ ~ dotnet --version

8.0.108

4.弃用fcitx

起因是设置不知为何闪退,且闪退的时机不定,点击设置左侧菜单项概率闪退。

终端运行gnome-control-center报错段错误

使用命令journalctl -xe查看日志:

9月 12 14:24:15 hcsci-ThinkPad-E15-Gen-4 systemd[2546]: Started app-gnome-org.gnome.Settings-24571.scope - Application launched by gnome-shell.

░░ Subject: UNIT 单元已结束启动

░░ Defined-By: systemd

░░ Support: http://www.ubuntu.com/support

░░

░░ UNIT 单元已结束启动。

░░

░░ 启动结果为“done”。

9月 12 14:24:16 hcsci-ThinkPad-E15-Gen-4 gnome-control-c[24571]: No IM module matching GTK_IM_MODULE=fcitx found

9月 12 14:24:16 hcsci-ThinkPad-E15-Gen-4 gnome-shell[2900]: Window manager warning: Buggy client sent a _NET_ACTIVE_WINDOW message with a timestamp of 0 for 0x6400004

9月 12 14:24:16 hcsci-ThinkPad-E15-Gen-4 gnome-shell[2900]: Can't update stage views actor unnamed [MetaWindowActorX11] is on because it needs an allocation.

9月 12 14:24:16 hcsci-ThinkPad-E15-Gen-4 gnome-shell[2900]: Can't update stage views actor unnamed [MetaSurfaceActorX11] is on because it needs an allocation.

9月 12 14:24:16 hcsci-ThinkPad-E15-Gen-4 kernel: gnome-control-c[24571]: segfault at 0 ip 00005c059cefc9fb sp 00007ffc2f280240 error 4 in gnome-control-center[5c059cec5000+141000] likely on>

9月 12 14:24:16 hcsci-ThinkPad-E15-Gen-4 kernel: Code: 0f 1e fa 8b 47 20 85 c0 74 05 c3 0f 1f 40 00 55 48 89 e5 53 48 89 fb 48 83 ec 08 48 8b 7f 70 e8 6b 2a fd ff 48 8b 7b 40 89 c6 <48> 8b >

重装设置和桌面不行

sudo apt-get install gnome-control-center

sudo apt-get install ubuntu-desktop

根据报错No IM module matching GTK_IM_MODULE=fcitx found,检查fcitx --version没问题,设置export GTK_IM_MODULE=fcitx也不行。

最后解决办法简单点,直接弃用搜狗输入法,不用fcitx了,直接改为iBus

步骤

在设置里修改输入法为iBus,点击应用到整个系统,重启(注意取消fcitx开机启动)。

在这里插入图片描述

最后添加<code>智能拼音输入法。

在这里插入图片描述

完成设置后,点了很多次都没闪退,那就暂时认为没问题了吧。

遗留问题:远程连接时点击显示器会崩溃,但笔记本点击不会。

5.clash沙箱配置

启动<code>clash时报错:

➜ Clash ./cfw

[123587:0914/104755.642606:FATAL:setuid_sandbox_host.cc(157)] The SUID sandbox helper binary was found, but is not configured correctly. Rather than run without sandboxing I'm aborting now. You need to make sure that /home/hcsci/Apps/Clash/chrome-sandbox is owned by root and has mode 4755.

[1] 123587 trace trap (core dumped) ./cfw

在Linux系统上,当尝试运行基于Electron框架的应用程序时,因为应用程序需要使用SUID沙箱(sandbox),但是沙箱没有被正确配置。

错误信息指出需要确保/home/hcsci/Apps/Clash/chrome-sandbox这个文件的所有者是root,并且具有4755的权限模式。

在这里插入图片描述

解决办法:(注意<code>chrome-sandbox的路径)

改变文件的所有者为root

sudo chown root /home/hcsci/Apps/Clash/chrome-sandbox

改变文件的权限模式为4755

sudo chmod 4755 /home/hcsci/Apps/Clash/chrome-sandbox

6.PostgreSQL模板排序规则版本不匹配

当前系统版本,由Ubuntu22.04编译

➜ ~ psql --version

psql (PostgreSQL) 16.4 (Ubuntu 16.4-1.pgdg22.04+1)

创建数据库CREATE DATABASE ar02;报错如下,表明在创建数据库时遇到了 collation version mismatch错误,操作系统的字符排序规则(collation)的版本与 template1 数据库使用的排序规则版本不匹配。

postgres.public> CREATE DATABASE ar02

[2024-10-10 14:05:48] [XX000] 错误: template database "template1" has a collation version mismatch

[2024-10-10 14:05:48] 详细:The template database was created using collation version 2.35, but the operating system provides version 2.39.

[2024-10-10 14:05:48] 建议:Rebuild all objects in the template database that use the default collation and run ALTER DATABASE template1 REFRESH COLLATION VERSION, or build PostgreSQL with the right library version.

会话连接到默认数据库postgres 时也提示版本错误:

[2024-10-10 14:03:00] 已连接

[2024-10-10 14:03:00] [01000] database "postgres" has a collation version mismatch

➜ ~ psql -U postgres -h localhost

用户 postgres 的口令:

警告: database "postgres" has a collation version mismatch

描述: The database was created using collation version 2.35, but the operating system provides version 2.39.

提示: Rebuild all objects in this database that use the default collation and run ALTER DATABASE postgres REFRESH COLLATION VERSION, or build PostgreSQL with the right library version.

psql (16.4 (Ubuntu 16.4-1.pgdg22.04+1))

SSL connection (protocol: TLSv1.3, cipher: TLS_AES_256_GCM_SHA384, compression: 关闭)

输入 "help" 来获取帮助信息.

postgres=#

咨询万能的ChatGPT,给出解决方法如下:

刷新排序版本

使用 ALTER DATABASE 命令刷新模板数据库的排序规则版本:

ALTER DATABASE template1 REFRESH COLLATION VERSION;

这样可以更新template1 数据库的排序规则版本,使其与系统当前的版本匹配。

重建受影响的对象

如果有依赖于旧排序规则的对象,可以选择重建这些对象。或者,您可以使用以下命令刷新排序规则版本:

sudo -u postgres psql -c 'REINDEX DATABASE template1;'

升级PostgreSQL 库

如果问题依旧,可能需要重建 PostgreSQL 来链接到新版本的库。通过包管理器升级 PostgreSQL:

sudo apt-get update

sudo apt-get install --only-upgrade postgresql

刷新数据库的排序规则版本

➜ ~ psql -U postgres -h localhost

用户 postgres 的口令:

警告: database "postgres" has a collation version mismatch

描述: The database was created using collation version 2.35, but the operating system provides version 2.39.

提示: Rebuild all objects in this database that use the default collation and run ALTER DATABASE postgres REFRESH COLLATION VERSION, or build PostgreSQL with the right library version.

psql (16.4 (Ubuntu 16.4-1.pgdg22.04+1))

SSL connection (protocol: TLSv1.3, cipher: TLS_AES_256_GCM_SHA384, compression: 关闭)

输入 "help" 来获取帮助信息.

postgres=# ALTER DATABASE postgres REFRESH COLLATION VERSION;

注意: 将版本从2.35更改为2.39

ALTER DATABASE

postgres=# \c template1;

警告: database "template1" has a collation version mismatch

描述: The database was created using collation version 2.35, but the operating system provides version 2.39.

提示: Rebuild all objects in this database that use the default collation and run ALTER DATABASE template1 REFRESH COLLATION VERSION, or build PostgreSQL with the right library version.

SSL connection (protocol: TLSv1.3, cipher: TLS_AES_256_GCM_SHA384, compression: 关闭)

您现在已经连接到数据库 "template1",用户 "postgres".

template1=# ALTER DATABASE template1 REFRESH COLLATION VERSION;

注意: 将版本从2.35更改为2.39

ALTER DATABASE

重新执行创建数据库CREATE DATABASE ar02;

postgres.public> CREATE DATABASE ar02

[2024-10-10 14:54:49] 在 66 ms 内完成

成功!!!就不继续测试了。

后续发现:

如果Ubuntu22.04时安装的是14或15,即16以下的,升级系统时会安装16,不会有问题;但如果开始就是16,升级后就存在该问题。

如果怕会有其他库版本不匹配的问题,可以卸载重装PostgreSQL最好。

我偷懒等后续再有版本问题再重装。



声明

本文内容仅代表作者观点,或转载于其他网站,本站不以此文作为商业用途
如有涉及侵权,请联系本站进行删除
转载本站原创文章,请注明来源及作者。