标签 Gentoo 下的文章

今天在更新系统的时候,提示 virtualbox-bin 从原始地址下载不了,经过一番摸索,通过下面的方式即可正常安装。

http://download.virtualbox.org/virtualbox/5.2.26/ 通过 上面这个网址找到你要下载的 virtualbox 版本, 选择后缀 .amd64.run 的来下载。下载可以使用 aria2c 来下载,下载完成之后,把 run 文件放入 /usr/portage/distfiles 文件夹即可。

再次安装,提示下载 pack 失败,从上面网页找到 Oracle_VM_VirtualBox_Extension_Pack-5.2.26-128414.vbox-extpack 类似这个下载下来。然后把文件名修改,去掉 vbox-extpack, 增加 tar.gz,变成 Oracle_VM_VirtualBox_Extension_Pack-5.2.26-128414.tar.gz,这个文件也放入到 /usr/portage/distfiles 即可。

这样再次安装就没有问题了。

首先修改内核:

Power management and ACPI options --->
    [*] Suspend to RAM and standby
    [*] Hibernation (aka 'suspend to disk')

然后安装 suspend 软件

emerge --ask sys-power/suspend

然后检查一下系统支持的模式

cat /sys/power/state

然后使用下面的命令就可以进入睡眠模式

echo mem > /sys/power/state

但是要使用休眠模式, 还需要增加一些操作.

  1. 在内核里面增加下面语句, 然后重新编译内核.

    resume=/dev/sda3 no_console_suspend
  2. 替换genkernel 软件, 原来的 genkernel 据说有 bug, 安装 genkernel-next软件, 替换原来的 genkernel 软件, 然后使用 genkernel --install initramfs, 重新生成 initramfs.

但是使用下面的命令进入休眠模式就有问题, 表现为系统休眠成功了, 但是唤醒不行, 变成冷开机了, 在冷开机的时候, 系统在 swap 里面发现了保存的东西, 但是不能从这么东西里面回复状态.

echo disk > /sys/power/state

这时候需要先安装 pm-utils 软件, 然后再使用下面几步:

  1. /etc/default/grub

    GRUB_CMDLINE_LINUX_DEFAULT="resume=/dev/sda3"
  2. grub-mkconfig -o /boot/grub/grub.cfg
  3. genkernel --install initramfs
  4. vim /etc/pm/config.d/gentoo
    SLEEP_MODULE="kernel"

然后 reboot 系统, 使用 pm-hibernate 来进入休眠模式, 后可以顺利 resume.

休眠的前面两步是否需要, 等以后验证.

经过另外在 nas 上面验证, 只需要下面几个步骤即可:

1. Power management and ACPI options --->
    [*] Suspend to RAM and standby
    [*] Hibernation (aka 'suspend to disk')
2.  pm-utils 
3. 后面的配置.

注意: 不需要在内核里面的 resume 语句, 不需要换成 genkernel-next 软件.

转自: http://www.wowotech.net/pm_subsystem/hibernation.html

出于省电和快速开机的需求, Hibernation经常被应用到Laptop和移动终端上,本文就简单讲讲Hibernation的一种实现实现方法,SWSUSP( Swap Suspend),其实swsusp从2.6开始就已经被引入到内核版本树中了,所以如果想分析swsusp的代码实现的话,还是挺方便的,只要有有2.6之后的内核代码即可。

本文不会过分深入分析代码,但文章最后会给出hibernation 和 resume的整体流程图。

- 阅读剩余部分 -

转自: https://linux.die.net/man/8/pm-hibernate

Name pm-action - Suspend or Hibernate your computer

Synopsis pm-hibernate [--help]

pm-suspend [--quirk---help] pm-suspend-hybrid [--quirk---help] Description

This manual page documents briefly the pm-action, pm-hibernate, pm-suspend and pm-suspend-hybrid commands. This manual page was originally written for the Debian(TM) distribution and has been adopted by the pm-utils project.

- 阅读剩余部分 -

在gentoo 上面,如果需要下载 youku 的视频的话,可以使用 annie 这个软件来下载。annie 软件主页:https://github.com/iawia002/annie#installation. annie 支持以下网站:

Site URL  Videos  Images  Playlist  VIP adaptation 抖音 https://www.douyin.com
哔哩哔哩 https://www.bilibili.com ✓ ✓ ✓ 半次元 https://bcy.net
pixivision https://www.pixivision.net
优酷 https://www.youku.com ✓ ✓ YouTube https://www.youtube.com ✓ ✓
爱奇艺 https://www.iqiyi.com
芒果TV https://www.mgtv.com
Tumblr https://www.tumblr.com ✓ ✓
Vimeo https://vimeo.com
Facebook https://facebook.com
斗鱼视频 https://v.douyu.com
秒拍 https://www.miaopai.com
微博 https://weibo.com
Instagram https://www.instagram.com ✓ ✓
Twitter https://twitter.com
腾讯视频 https://v.qq.com
网易云音乐 https://music.163.com
音悦台 https://yinyuetai.com

先安装 go 语言:

emerge -av go

然后安装 annie

go get github.com/iawia002/annie

可以先用 annie -i URL 来查看视频相关信息,比如说不同的视频质量, 然后用 annie -f mp4hd2 URL 这样的命令来下载指定质量的视频。 对于 youku 的URL,比如说: https://v.youku.com/v_show/id_XMjY1NTc3NDc0OA==.html?spm=a2h0k.11417342.soresults.dtitle 可以只用 https://v.youku.com/v_show/id_XMjY1NTc3NDc0OA==.html 即可。

参考: Configuring Thunderbird and Using it to Access Office 365 Mail and Calendar in Cardiff University https://docs.cs.cf.ac.uk/notes/thunderbird-email-application/

Doesn't work with Thunderbird 60 https://github.com/Ericsson/exchangecalendar/issues/628

Configuring Exchange Email and Calendar in Thunderbird http://blogs.umass.edu/Techbytes/2014/04/03/configuring-exchange-email-and-calendar-in-thunderbird/

thunderbird 可以同步网络日历,比如说微软的 hotmail 的日历。首先到 hotmail 上面,配置 --> 共享日历 --> 发布日历 然后复制 ics 日历。 在thunderbird 里面新建日历,选择网络日历,然后把 ics 地址复制进去,就可以了, 后面只需要手动同步日历一下,就可以了。 但是这种方法只能用于接受 hotmail 的日历,不能推送给 hotmail。

经过,多次搜索,测试,终于找到能够双向更新的方法。 首先安装 Equilla 插件,这个用来配置 hotmail 的 exchange 服务,收取邮件。 然后安装 tbsync 插件,最后安装 exchange calendar 插件。

Equilla 和 tbsync 这两个插件都可以在 thunderbird 的 tools 里面找到安装。但是 exchange calendar 只能自己下载,然后安装,下载地址:https://github.com/ExchangeCalendar/exchangecalendar/releases.

安装 exchange calendar 之后,就可以新建 calendar 的时候选择 MS 格式了,然后安装需要配置即可。

thunderbird 163 smtp 如果要正常发送,配置如下:

server: smtp.163.com
port: 465
auth: Normal password
security: SSL/TLS

测试的时候如果提示: DT:SPM,这个是垃圾邮件的提示。测试邮件可以添加抄送给自己,这样不容易作为垃圾邮件被挡住。

参考 [SOLVED] qtcreator: examples are missing https://forums.gentoo.org/viewtopic-t-1092826-highlight-qtcreator.html

最近安装了 qt-creator,后发现了几个问题:

  1. help 里面只有 qt-creator 的内容,没有 qt 的内容。
  2. examples 是空的。

解决方法是:

  1. 安装 qt-docs,这样就有 qt 的帮助了。
  2. qt5 之后就没有 qt-demo 了,所以只能用新的方法。建立本地软件仓库来安装 非官方的 qt-examples。可以按照我上一篇随笔来做。 gentoo 建立本地软件库并安装软件 Custom repository https://www.cnblogs.com/ramlife/p/10425850.html

按照这个安装好了之后,重新打开 qt-creator ,就有 examples 了。

具体的 5.11.1 的 qt-examples ebuild 从这个连接下载: https://bugs.gentoo.org/669268 https://bugs.gentoo.org/attachment.cgi?id=552234

参考 Handbook:AMD64/Portage/CustomTree https://wiki.gentoo.org/wiki/Handbook:AMD64/Portage/CustomTree#Defining_a_custom_repository

Custom repository https://wiki.gentoo.org/wiki/Custom_repository

/etc/portage/repos.conf https://wiki.gentoo.org/wiki//etc/portage/repos.conf

首先建立软件库的文件夹

root #mkdir -p /usr/local/portage/{metadata,profiles}
root #chown -R portage:portage /usr/local/portage

然后起个便于识别的软件库名字,比如 localrepo:

root #echo 'localrepo' > /usr/local/portage/profiles/repo_name

然后设定这个软件库的主软件库是 gentoo,并且这个本地软件库不会自动更新。

vim /usr/local/portage/metadata/layout.conf
masters = gentoo
auto-sync = false

最后告诉系统软件库,有这么一个本地软件库。

vim /etc/portage/repos.conf/localrepo.conf
[localrepo]
location = /usr/local/portage

安装 repoman 来处理本地软件库。

emerge -v repoman

建立实际需要的软件的文件夹,并放入相应的 ebuild 文件,然后 使用 repoman 导入 manifest中,导入的时候会自动下载安装包到 /usr/portage/distfiles 里面。

mkdir -p /usr/local/portage/dev-qt/qt-examples
cp /home/用户名/Downloads/qt-examples-5.11.1.ebuild /usr/local/portage/dev-qt/qt-examples/
chown -R portage:portage /usr/local/portage
pushd /usr/local/portage/dev-qt/qt-examples
repoman manifest
popd

这时候就可以使用 emerge -pv qt-examples 来安装软件了。

也可以把刚才的简历文件夹,放入 ebuild 那一步做成脚本:

vim repoAdd.sh
#!/bin/sh
mkdir -p /usr/local/portage/$1/$2
cp $3 /usr/local/portage/$1/$2/
chown -R portage:portage /usr/local/portage
pushd /usr/local/portage/$1/$2
repoman manifest
popd

然后使用 这样的格式 (package_category package_name ebuild)

root #repoAdd app-dicts artha ~larry/artha-1.0.2.ebuild

如果使用 git 来管理软件库的话,可以使用下面的文件来管理:

vim /etc/portage/repos.conf/brother-overlay.conf
[brother-overlay]
location = /usr/local/overlay/brother-overlay
sync-type = git
sync-uri = https://github.com/stefan-langenmaier/brother-overlay.git
auto-sync = yes

Custom repository https://wiki.gentoo.org/wiki/Custom_repository 这个文档里面还有 如何升级本地仓库和交叉编译仓库 crossdev