加速linux开机速度 systemctl

可以将 nouveau禁用以加快开机速度 ,nouveau为逆向nvidia效果不太好,会拖慢开机速度
所以 /etc/modprobe.d/blacklist.conf 
blacklist nouveau 
利用命令lsmod | grep nouveau查看是否禁止



 systemctl list-units --type=service 显示所有已启动的服务 或者
systemctl list-unit-files | grep enable

systemctl list-unit-files --type=service | grep enabled 列出开机启动项centos有chkconfig  ubuntu有类似的sysv-conf但用sysv-conf禁用后用systemctrl还是有的能够启动
好像是最新的命令chkconfig service等都合并为systemctrl了 systemctrl为systemd的一个工具就如ifconfig和ip新旧命令
http://blog.csdn.net/example440982/article/details/51794440 systemctrl介绍
systemctl命令是系统服务管理器指令,它实际上将 service和 chkconfig 这两个命令组合到一起。

停用的服务进程仍然能够被另外一个服务进程启动。如果你真的想在任何情况下系统启动时都不启动该进程,无需卸载该它,只需要把它掩盖起来就可以阻止该进程在任何情况下开机启动。

 
  1. $ sudo systemctl mask bluetooth.service
  2. Created symlink from /etc/systemd/system/bluetooth.service to /dev/null.

 

 
 sudo systemctl unmask bluetooth.service后重启比如vm关掉不能运行

 

 

 

一旦你对禁用该进程启动而没有出现负面作用感到满意,你也可以选择卸载该程序。

 

这里举例了几个服务进程的作用。许多服务进程都是发行版特定的,所以你应该看看你的发行版文档(比如通过 google 或 StackOverflow)。

  • accounts-daemon.service 是一个潜在的安全风险。它是 AccountsService 的一部分,AccountsService 允许程序获得或操作用户账户信息。我不认为有好的理由能使我允许这样的后台操作,所以我选择掩盖mask该服务进程。
  • avahi-daemon.service 用于零配置网络发现,使电脑超容易发现网络中打印机或其他的主机,我总是禁用它,别漏掉它。
  • brltty.service 提供布莱叶盲文设备支持,例如布莱叶盲文显示器。
  • debug-shell.service 开放了一个巨大的安全漏洞(该服务提供了一个无密码的 root shell ,用于帮助 调试 systemd 问题),除非你正在使用该服务,否则永远不要启动服务。
  • ModemManager.service 该服务是一个被 dbus 激活的守护进程,用于提供移动宽频broadband(2G/3G/4G)接口,如果你没有该接口,无论是内置接口,还是通过如蓝牙配对的电话,以及 USB 适配器,那么你也无需该服务。
  • pppd-dns.service 是一个计算机发展的遗物,如果你使用拨号接入互联网的话,保留它,否则你不需要它。
  • rtkit-daemon.service 听起来很可怕,听起来像是 rootkit。 但是你需要该服务,因为它是一个实时内核调度器real-time kernel scheduler。
  • whoopsie.service 是 Ubuntu 错误报告服务。它用于收集 Ubuntu 系统崩溃报告,并发送报告到 https://daisy.ubuntu.com 。 你可以放心地禁止其启动,或者永久的卸载它。
  • wpa_supplicant.service 仅在你使用 Wi-Fi 连接时需要。

 

那么如何找出拖慢开机速度的元凶并将其禁用呢?

 

systemd自带分析利器systemd-analyze


systemd-analyze有一些参数,大体上来讲就是一些功能, 可以用

man systemd-analyze

其中, 对我们比较有用的参数就是blame。

blame : blame是"指责"的意思。

 同理, systemd-analyze blame就是显示开机启动项的时间, 从最慢依次列出。然后有选择的禁用切忌不要把系统核心的给禁用了,systemctrl disable xxx但有的无法disable只能用mask了也就是说 mask 选项把 service 直接软链接到了 /dev/null 这个著名的「黑洞」中去了,然后世界就清净了。
开机不检查磁盘,vi /etc/fstab 把/dev/sda2的0 1 改为0 0

任务旧指令新指令
使某服务自动启动chkconfig --level 3 httpd onsystemctl enable httpd.service
使某服务不自动启动chkconfig --level 3 httpd offsystemctl disable httpd.service
检查服务状态service httpd statussystemctl status httpd.service (服务详细信息) systemctl is-active httpd.service (仅显示是否 Active)
显示所有已启动的服务chkconfig --listsystemctl list-units --type=service
启动某服务service httpd startsystemctl start httpd.service
停止某服务service httpd stopsystemctl stop httpd.service
重启某服务service httpd restartsystemctl restart httpd.service

 

 

 

 

 

 

  

 

 

 

 

sudo systemctl enable NetworkManager.service 用于管理设置中无线 以及 有线链接 已经自动开机启动了

sudo systemctl disable packagekit.service

sudo systemctl mask packagekit.service

sudo systemctl disable fwupd.service
sudo systemctl disable udisks2.service

sudo systemctl disable apt-daily-upgrade.service

sudo systemctl disable  apt-daily.service
sudo systemctl mask apt-daily-upgrade.service
sudo systemctl mask apt-daily.service
sudo systemctl disable lightdm.service

sudo apt remove lightdm
sudo systemctl disable linuxlogo.service
sudo systemctl disable ModemManager.service
sudo systemctl disable accounts-daemon.service
sudo systemctl disable NetworkManager-wait-online.service
 

sudo systemctl disable  vmware.service

sudo systemctl disable  vmware-workstation-server.service

sudo systemctl disable  vmware-USBArbitrator.service

sudo systemctl mask  vmware-workstation-server.service 具体不知道有什么作用 mask 也没什么影响
sudo systemctl mask  vmware-USBArbitrator.service 当usb设备如优盘插入时起作用
 

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值