Hyper-V 安装 Ubuntu22.04 LTS 后,如何调整分辨率?

本文将介绍如何处理通过 hyper-v 安装 Ubuntu22.04 LTS 后调整它的分辨率。

总体思路:修改 Ubuntu 的 /etc/default/grub 配置,然后更新 grub,重启系统。详细过程如下:

修改 grub 文件权限

grub 文件的默认权限是只读的,我们需要通过 chmod 命令修改它的权限。命令如下:

hxstrive@localhost:~/桌面$ sudo chmod 774 /etc/default/grub
[sudo] hxstrive 的密码:

编辑 grub 文件

你可以选择使用 Ubuntu 默认的编辑器 gedit 去编辑 grub 文件,命令如下:

hxstrive@localhost:~/桌面$ sudo gedit /etc/default/grub

执行上面命令后,将打开 gedit 编辑器,然后我们就可以编辑 grub 文件了。或者使用 vim 编辑器,但是默认 Ubuntu 没有安装 Vim,则是自带 Vi 编辑器。命令如下:

hxstrive@localhost:~/桌面$ sudo vim /etc/default/grub

主要修改 “GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"

将它修改为“GRUB_CMDLINE_LINUX_DEFAULT="quiet splash video=hyperv_fb:1366x768"

上面配置会将 Ubuntu 的分辨率改为 1366x768,配置完后如下图:

Hyper-V 安装 Ubuntu22.04 LTS 后,如何调整分辨率?

更新 grub

使用 sudo 权限执行 update-grub 命令更新 grub,如下:

hxstrive@hxstrivehost:~/桌面$ sudo update-grub
[sudo] hxstrive 的密码: 
Sourcing file `/etc/default/grub'
Sourcing file `/etc/default/grub.d/init-select.cfg'
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-5.15.0-52-generic
Found initrd image: /boot/initrd.img-5.15.0-52-generic
Found linux image: /boot/vmlinuz-5.15.0-43-generic
Found initrd image: /boot/initrd.img-5.15.0-43-generic
Memtest86+ needs a 16-bit boot, that is not available on EFI, exiting
Warning: os-prober will not be executed to detect other bootable partitions.
Systems on them will not be added to the GRUB boot configuration.
Check GRUB_DISABLE_OS_PROBER documentation entry.
Adding boot menu entry for UEFI Firmware Settings ...
done

重启系统

使用 sudo 权限执行 reboot 命令去重启系统,重启后系统分辨率就是你想要的了。命令如下:

hxstrive@hxstrivehost:~/桌面$ sudo reboot
如果在胜利前却步,往往只会拥抱失败;如果在困难时坚持,常常会获得新的成功。
0 不喜欢
说说我的看法 -
全部评论(

感谢分享,我按照配置修改后果然有用,但是我修改的分辨率是 1920x1080。

回复:

谢谢支持!你的支持,是我们更新的动力

关于
本网站专注于 Java、数据库(MySQL、Oracle)、Linux、软件架构及大数据等多领域技术知识分享。涵盖丰富的原创与精选技术文章,助力技术传播与交流。无论是技术新手渴望入门,还是资深开发者寻求进阶,这里都能为您提供深度见解与实用经验,让复杂编码变得轻松易懂,携手共赴技术提升新高度。如有侵权,请来信告知:hxstrive@outlook.com
其他应用
公众号