作者:张华 发表于:2022-04-23
版权声明:可以任意转载,转载时请务必以超链接形式标明文章原始出处和作者信息及本版权声明
( http://blog.csdn.net/quqi99 )
昨天通过’sudo do-release-upgrade -d -f DistUpgradeViewNonInteractive’将ubuntu 20.04升级到了ubuntu 22.04 (注:从LTS版本升级到LTS版本一般得等8月份第1个小版本出来才会正式将22.04标为LTS,在此之前应加-d参数).
autofs与sssd冲突的问题
升级之后,今天发现一个问题,autofs不好使了.通过下列命令调试时看到了sssd字眼.
sudo systemdctl stop autofs
sudo automount --debug -f
发现sssd无法启动,将sssd删除之后(apt purge sssd) autofs就恢复正常了.
nfsv4不work的问题
还有一个问题,在升级之后nfs4不work了(mount -t nfs -s -o nfsvers=4,rw,rsize=32768,wsize=32768 nas:/Public /nas),待查,先不得不降到nfs3
$ cat /etc/auto.direct
/nas -fstype=nfs,nfsvers=3,rw,rsize=32768,wsize=32768 nas:/Public
$ cat /etc/auto.direct
/nas -fstype=nfs,nfsvers=3,rw,rsize=32768,wsize=32768 nas:/Public
使用下列方法debug nfs(也可使用:rpcdebug -m nfs -s all), 并看到下列错误,似乎是kernel 5.15与nfsv4(nfs-common)不work - https://bugzilla.redhat.com/show_bug.cgi?id=1719903
# https://www.serverstack.com/blog/2012/11/21/debugging-nfs-file-access-on-server-and-client-side/index.html
sudo rpcdebug -m nfs -s proc
sudo tail -f /var/log/syslog
sudo mount -t nfs -o nfsvers=4 nas:/Public /mnt/tmp
Apr 24 09:07:13 t440p kernel: [84981.523081] nfs41_sequence_process: Error 0 free the slot
Apr 24 09:07:13 t440p kernel: [84981.523102] nfs4_proc_get_locations: FSID 52706b7bf323e1f3:0 on "nas"
Apr 24 09:07:13 t440p kernel: [84981.523106] nfs4_proc_get_locations at 000000006bf14052 is 28 bytes, crc: 0x83e7aee1:
Apr 24 09:07:13 t440p kernel: [84981.523109] 01000700 01007204 00000000 52706b7b
Apr 24 09:07:13 t440p kernel: [84981.523111] f323e1f3 00000000 00000000
Apr 24 09:07:13 t440p kernel: [84981.523115] --> nfs41_call_sync_prepare data->seq_server 00000000209ff6e2
正常的切换到ubuntu 18.04,nfsv4正常并有下列日志:
Apr 24 09:15:52 node1 kernel: [ 113.578775] NFS call setclientid auth=UNIX, 'Linux NFSv4.0 node1/192.168.99.238'
Apr 24 09:15:52 node1 kernel: [ 113.579047] NFS reply setclientid: 0
Apr 24 09:15:52 node1 kernel: [ 113.579048] NFS call setclientid_confirm auth=UNIX, (client ID 1de13162db060000)
Apr 24 09:15:52 node1 kernel: [ 113.579636] NFS reply setclientid_confirm: 0
Apr 24 09:15:52 node1 kernel: [ 113.579681] NFS call setclientid auth=UNIX, 'Linux NFSv4.0 node1/192.168.99.238'
Apr 24 09:15:52 node1 kernel: [ 113.580082] NFS reply setclientid: 0
Apr 24 09:15:52 node1 kernel: [ 113.580083] NFS call setclientid_confirm auth=UNIX, (client ID 1de13162db060000)
Apr 24 09:15:52 node1 kernel: [ 113.580702] NFS reply setclientid_confirm: 0
Apr 24 09:15:52 node1 kernel: [ 113.580714] --> nfs4_get_lease_time_prepare
Apr 24 09:15:52 node1 kernel: [ 113.580715] <-- nfs4_get_lease_time_prepare
Apr 24 09:15:52 node1 kernel: [ 113.581092] --> nfs4_get_lease_time_done
Apr 24 09:15:52 node1 kernel: [ 113.581094] <-- nfs4_get_lease_time_done
Apr 24 09:15:52 node1 kernel: [ 113.583488] NFS call lookup Public
Apr 24 09:15:52 node1 kernel: [ 113.583709] NFS reply lookup: 0
Apr 24 09:15:52 node1 kernel: [ 113.583712] NFS call lookup Public
Apr 24 09:15:52 node1 kernel: [ 113.584106] NFS reply lookup: 0
无法ssh到dropbear的问题
另外,还遇到一个ssh问题,报:no matching host key type found. Their offer: ssh-rsa, 通过下列方法解决:
$ tail -n3 /etc/ssh/ssh_config
KexAlgorithms +diffie-hellman-group1-sha1
HostkeyAlgorithms +ssh-dss,ssh-rsa
PubkeyAcceptedKeyTypes +ssh-dss,ssh-rsa
20230915更新 - n1box上的ssh的问题(ssh server可以安装simpledroid, 默认端口是2222),当从n1box通过dropbear
su && mount -o remount,rw /system && mount -o remount,rw /data
echo '192.168.99.186 t440p' >>/etc/hosts
#/system/etc/dropbear/.ssh and /data/user/0/org.galexander.sshd/files/.ssh
find / -name '.ssh' |less
#the ssh home is /data/user/0/org.galexander.sshd/files/.ssh after installing simpledroid
dropbearkey -t rsa -s 2048 -f ~/.ssh/id_rsa > ~/.ssh/id_rsa.pub
cat /data/user/0/org.galexander.sshd/files/.ssh/id_rsa.pub
#fix 'No matching algo hostkey' when ssh to t440p from n1box
echo "KexAlgorithms diffie-hellman-group1-sha1" |sudo tee -a /etc/ssh/sshd_config
echo "HostKeyAlgorithms +ssh-rsa" |sudo tee -a /etc/ssh/sshd_config
echo "PubkeyAcceptedAlgorithms +ssh-rsa" |sudo tee -a /etc/ssh/sshd_config
sudo systemctl restart ssh
chmod 600 /data/user/0/org.galexander.sshd/files/.ssh/id_rsa
ssh hua@t440p -i ~/.ssh/id_rsa
gnome lunar-calendar插件无法显示中文的问题
升级到ubuntu 22.04之后,发现我之前在20.04下一直使用的一些gnome插件消失了(如跨时区显示时间,如天气,截屏, 具体见: https://extensions.gnome.org/local/ ). 在运行下列命令并重启机器之后截屏恢复了(sudo apt install gnome-screenshot, https://extensions.gnome.org/extension/1112/screenshot-tool/ ),但天气(https://extensions.gnome.org/extension/750/openweather/) 和跨时区显示时间(https://extensions.gnome.org/extension/1060/timezone/)的还是未恢复.
sudo apt install gnome-shell-extensions gnome-tweaks gnome-shell-extension-manager chrome-gnome-shell -y
then need to reboot the machine
sudo systemctl status display-manager
先安装依赖(apt install gir1.2-lunar-date-3.0),再安装农历插件https://extensions.gnome.org/extension/675/lunar-calendar/ ,最后需设置ubuntu语言全系统为中文农压显示才不会乱码。
其他设置
也做了其他一些设置:
# avoid: update-notifier.desktop[132410]: Cannot stat file /proc/3829/fd/1023: Permission denied
sudo apt purge update-notifier update-notifier-common -y
# avoid: /usr/lib/systemd/system-generators/netplan failed with exit status 1.
sudo mv /etc/netplan/01-network-manager-all.yaml /etc/netplan/01-network-manager-all.yaml_bak
sudo netplan apply
# fwupd-refresh.service: Main process exited
# https://github.com/fwupd/fwupd/issues/2058
fwupdmgr refresh -v
fwupdtool get-updatessudo
sudo systemctl disable fwupd-refresh
20220507更新
继续将一台台式机也更新到ubuntu 22.04时遇到了下列错误:
hua@node1:~$ sudo update-initramfs -u -k all -v
...
Calling hook reiserfsprogs
Adding binary-link sbin/reiserfsck
ln: failed to create symbolic link '/var/tmp/mkinitramfs_c7SIXF/sbin/reiserfsck': File exists
Adding binary /usr/sbin/reiserfsck
cp: failed to access '/var/tmp/mkinitramfs_c7SIXF//usr/sbin/reiserfsck': Too many levels of symbolic links
E: /usr/share/initramfs-tools/hooks/reiserfsprogs failed with return 1.
Removing /boot/initrd.img-5.4.0-109-generic.dpkg-bak
update-initramfs: failed for /boot/initrd.img-5.4.0-109-generic with 1.
hua@node1:~$ sudo find /usr/share/initramfs-tools/ -name 'reiserfsprogs'
/usr/share/initramfs-tools/hooks/reiserfsprogs
运行下列命令解决:
sudo mv /usr/share/initramfs-tools/hooks/reiserfsprogs /tmp/
sudo dpkg --configure -a && sudo apt -f install
#sudo dpkg -S /usr/share/initramfs-tools/hooks/reiserfsprogs
#sudo dpkg -P reiserfsprogs
还有一个问题:
Errors were encountered while processing:
usrmerge
继续解决:
sudo apt purge usrmerge
sudo dpkg --configure -a && sudo apt -f install
20220512更新 - 升级thinkpad x1yoga的问题
将thinkpad x1 yoga也从ubuntu 20.04升级到22.04, 结果遇到了一个大问题. 按poweroff后无法关机(屏幕关了,但FnLk灯还亮着可能是电源没关),所以需长按电源键才能关机,然后再短按电源键才能开机. 最近一次日志里也没看到什么异常日志.
# 显示最后一次关闭 Linux 系统之前的系统日志, -r代表按时间倒序显示
sudo journalctl -rb -1
5月 12 09:24:47 x1 systemd-journald[268]: Journal stopped
5月 12 09:24:47 x1 systemd-shutdown[1]: Sending SIGTERM to remaining processes...
5月 12 09:24:46 x1 systemd-shutdown[1]: Syncing filesystems and block devices.
5月 12 09:24:46 x1 systemd[1]: Shutting down.
5月 12 09:24:46 x1 systemd[1]: Reached target System Power Off.
...
为了加速重启测试速度修改了:
cat << EOF | sudo tee -a /etc/systemd/system.conf
DefaultTimeoutStopSec=4s
EOF
sudo systemctl daemon-reload
在grub中测试了下列选项, 没一个能解决问题的:
reboot=efi
reboot=bios
reboot=acpi
reboot=pci
acpi=force
apm=power_off
接着测试了更新firmwall, 但也不能解决问题:
fwupdmgr refresh --force
fwupdmgr get-updates
fwupdmgr update
也测试了下列能让OS无法启动的方法:
# append 'apm power_off=1' into /etc/modules as well. NOTE: it will cause os not be able to boot
#GRUB_CMDLINE_LINUX="noacpi acpi=off acpi=force apm power_off=1
上述方法让OS无法启动, 在使用启动盘修复启动的过程中又发现了一个默认值的问题, ubuntu 22.04在grub中必须添加下列配置才能发现win10双分区.
#remove 20_memtest86+ and set GRUB_DISABLE_OS_PROBER=false to intect
#grep memtest /boot/grub/grub.cfg
sudo mv /etc/grub.d/20_memtest86+ .
GRUB_DISABLE_OS_PROBER="false"
sudo update-grub
上面运行了grub就有windows了也有linux, 然后进windows了发现莫名其妙地重启后grub又消失了.
只好继续启动盘进ubuntu, 但此时居然报:
grub-probe cannot find a grub drive for /dev/sda1 check your device.map
blkid |grep sda1
cat /boot/grub/device.map
没办法, 只好试着使用ubuntu 20.04重装并从22.04降级到20.04. 用ubuntu 20.04启动盘选择不格rootfs的那个安装模式,这样它不会毁坏你在rootfs上自己的数据,至于应用应该联网让它多保留你之前已经安装的应用,新版的应用配置文件会延用以前的,这样可以只是少数应用无法用而已.
注: 由于是降级,所以上面的并未保留数据,那就装完ubuntu 20.04后继续进usb启动盘(192.168.99.125,安装openssh-server)来从t440p上将rootfs sync过来吧.
rsync -xavP --numeric-ids --exclude='/nas' --exclude='/bak' --exclude='/tmp' --exclude='/EFI' --exclude='/media' --exclude='/mnt' / root@192.168.99.125:/mnt/
20240404 - dropbear
dropbearkey -t rsa -f ~/.ssh/id_rsa
# Convert public key from dropbear binary to openssh text
dropbearkey -y -f ~/.ssh/id_rsa | head -n 2 | tail -1
实际上上面创建的key无法用在autossh中。应该是直接用/etc/dropbear/dropbear_rsa_host_key, 它的公钥如下:
dropbearkey -y -f /etc/dropbear/dropbear_rsa_host_key | grep "^ssh-rsa " > /etc/dropbear/authorized_keys
或,要在op上运行autossh得:
- dropbear不支持ssh的-C参数,所以需要安装opkg install openssh-client
- 需要ssh证书可以在ubuntu上创建了再拷到op系统上
这样就可以运行:
/usr/sbin/autossh -M20000 -i ~/.ssh/id_rsa_gw -q -C -N -D 0.0.0.0:7070 -oStrictHostKeyChecking=no root@xxx -p2083
root@gw:~# cat /etc/init.d/autossh
#!/bin/sh /etc/rc.common
#logread |grep ss
START=82
STOP=01
start() {
ulimit -HSn 65536
ulimit -c unlimited
ulimit -n 65534
/usr/sbin/autossh -M20000 -i /root/id_rsa_gw -q -C -N -D 0.0.0.0:7070 -oStrictHostKeyChecking=no root@xxx.com -p2083 &
}
stop() {
/usr/bin/killall autossh
}
20240628 - upgrade to ubuntu 24.04
今天原本是想将运行命令’sudo do-release-upgrade -d -f DistUpgradeViewNonInteractive’将系统将ubuntu 22.04升级到ubuntu 24.04,但有问题。 所以想着先’sudo do-release-upgrade -f DistUpgradeViewNonInteractive‘将系统从ubuntu 22.04升级到ubuntu 23.04再进而升级到ubuntu 24.04,但也有问题。
算了,免得那么麻烦了,直接将/etc/apt/sources.list文件里的jammy替换为noble,然后’apt upgrade && apt dist-upgrade’就可以了。
升级后遇到两个问题:
- chrome打不开的问题,说什么权限的问题,搞了半天没搞成,看到网上说需要重启,重启之后记得第一次运行还是打不开,但正无计可施之时,怎么莫名其妙地又打开了,用起来无问题。
- wps显示黑块的问题。可使用’sudo cp /snap/gnome-42-2204/current/usr/lib/x86_64-linux-gnu/libfreetype.so.6.18.1 /opt/kingsoft/wps-office/office6/libfreetype.so.6’ 将libfreetype.so.6的版本从系统默认的6.20.1版本(/usr/lib/x86_64-linux-gnu/libfreetype.so.6 )降为snap使用的6.18.1版本即可。
20240705重启机器后,又莫名其妙的打不开chrome了,然后运行下列workaround之后就可以正常了:
sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0
另一个问题是gnome剪贴板总有问题,好像就是因为打开了’gnome-remote-desktop.service’服务造成的。
gedit有时候打不开, gedit通过命令行能打开,里面有时候剪贴板不好使也是因为gnome-remote-desktop.service
gnome-xrdp (gnome-remote-desktop.service)用不了
20250224 - 电脑风扇晚上忽然狂转
半夜电脑风扇狂转,上午又开发狂转了,一检查原来是cups-browsed的cpu占用率过高, 升级cups-browsed就解决了 - https://bugs.launchpad.net/ubuntu/+source/cups-browsed/+bug/2067918
另外,还有一个wpscloudsvr进程, 禁用它:
killall wpscloudsvr
sudo mv /opt/kingsoft/wps-office/office6/wpscloudsvr /opt/kingsoft/wps-office/office6/wpscloudsvr_bak
sudo touch /opt/kingsoft/wps-office/office6/wpscloudsvr
20250226 - 放弃 gnome notification提醒改用chrome notification
之前遇到过在android手机上由于华为手表删除日历的事情,所以我就将ubuntu桌面的日历删除了,现在又要求打开gnome notification 1) 在ubuntu设置中登录公司邮箱 2) sudo apt install gnome-calendar evolution-data-server -y 3) 打开gnome-calendar检查日历 4)安装https://extensions.gnome.org/extension/1386/notification-counter/显示未读信息 5)这个进程(ps -ef |grep evolution-alarm-notify)负责同步 6)日历通知可以在gcalendar中设置的每一个具体日历订阅中设置。
可明明在ubuntu的’设置-> 通知’处将’events and task reminders’里将声音打开了, 但gnome能看到calendar通知但没有声音,mattermost则有声音。并且已经在gcalendar中设置声音提醒(在gcalendar的setting针对具体的订阅设置提前多长时间提醒), 用(notify-send “test” “here is a test!” -u critical)能快速测试也没声音, 用(pactl subscribe)没监控到声音,用(journalctl -b -f | grep -i “sound”)也没看到输出。evolution-data-server包已经安装evolution-alarm-notify进程也在运行, 但用gnome-calendar打开看到的日志的通知处的声音就是关的。也发现gnome-calendar中的日历订阅不全(原因是在帐户登录处需要将日历的可读可写权限都给它?如果将可写权限也给gnome会不会又遇到之前华为手表上同步日历时出现删除日历的事件呢?这显然是不安全的, 我最终改成这种方式就是在gnome-calendar添加有secret的iCal格式的日历链接它是只读的, 但一是gnome添加公司帐号时没有能选只读日历的设置二是公司帐号中也没有secret iCal格式的日历,所以最终我只能放弃使用gnome来通知)
我放弃了使用gnome来做日历提醒之后,发现可以通过chrome来提醒,设置方法是1)在gcalendar中的"General -> Notification Settings"将Alerts改成’Desktip notifications’ ,2)在chrome设置(chrome://settings/content/notifications)允许发通知。这样设置之后,手机与电脑都有声音提醒,完美 。