标签 Gentoo 下的文章

nvidia 内核配置

[*] Enable loadable module support --->
Processor type and features --->
   [*] MTRR (Memory Type Range Register) support
Device Drivers --->
   Graphics support --->
      [*] VGA Arbitration
Device Drivers --->
   Character devices --->
      [*] IPMI top-level message handler

framebuffer 会和 nvidia 冲突,所以去除一些内核选项。

Device Drivers --->
    Graphics support --->
        Frame buffer Devices --->
            <*> Support for frame buffer devices --->
            < >   nVidia Framebuffer Support
            < >   nVidia Riva support
Device Drivers  --->
    Graphics support  --->
        < > Nouveau (nVidia) cards

CONFIG_FB_EFI 使能时也会导致驱动有一些问题,所以需要配置如下:

Bus options (PCI etc.)  --->
   [*] Mark VGA/VBE/EFI FB as generic system framebuffer
Device Drivers --->
   Graphics support --->
        Frame buffer Devices --->
            [*] Simple framebuffer support

X 配置

  1. USE=“X” 写入 /etc/portage/make.conf.
  2. 配置内核
Device Drivers --->
  Input device support --->
  <*>  Event interface
Device Drivers --->
   Graphics support --->
      Frame Buffer Devices --->
         <*> Support for frame buffer devices --->
         ## (Disable all drivers, including VGA, Intel, NVIDIA, and ATI, except EFI-based Framebuffer Support, only if you are using UEFI)

      ## (Further down, enable basic console support. KMS uses this.)
      Console display driver support --->
         <*>  Framebuffer Console Support

注意: uefi framebuffer 也不能选择,参考 nvidia 部分,使用 simple framebuffer.

  1. VIDEO_CARDS="nvidia"INPUT_DEVICES="libinput synaptics" 写入到 /etc/portage/make.confportageq envvar INPUT_DEVICES 可以用来查看当前的输入设备。
  2. 安装 xorg emerge -av x11-base/xorg-drivers, emerge --ask x11-base/xorg-server。也可以把 xorg-server 替换为 x11-base/xorg-x11xorg-x11 这个包比 xorg-server大,多了很多字体和其他的一些东西,很多用不上,后面需要再专门安装缺少的。
  3. env-update 然后 source /etc/profile

安装 nvidia 驱动

  1. emerge -av x11-drivers/nvidia-drivers 确保 tools 开启,会自动安装 nvidia-settings。
  2. gpasswd -a xyz video, 把用户加入到 vidio 组里面。

startx

  1. 切换到普通用户,然后运行 startx,发现报错,文件找不到等等,具体信息可以在 ~/.local/share/xorg/Xorg.0.log 里面找到。
  2. 配置文件在 /etc/X11/xorg.conf.d/, 示例在 /usr/share/doc/xorg-server-${version}/xorg.conf.example.bz2
  3. /etc/X11/xorg.conf.d/nvidia.conf 里面写入:
    Section "Device"
    Identifier  "nvidia"
    Driver      "nvidia"
    EndSection
  4. 经过仔细搜索发现这是个比较久的问题。18年的时候,就已经出现了。本质的原因是 xorg-server 的 suid 这个 USE 的问题, suid 能够让使用者的权限提升到拥有者的权限,在以前, xorg-server 会默认带有 suid,这样普通用户也可以 startx。后来 xorg-server 增加了 elogind 这个 use, 可以使用 elogind 而不是 suid,这样 普通用户也可以使用 startx 了,而且因为 systemd 的出现,新的 kde 等桌面,要不依赖 systemd,要不依赖于 elogind.
  5. 在 make.conf 里面的 USE 里面增加 elogind,这样全局开启 elogind,然后 emerge -avuDN @world, 然后 emerge --depclean, `emerge
  6. rc-update add elogind boot 把 elogind 增加到 boot 启动里面,否则 pam_elogind 会遇到问题。 参考: https://wiki.gentoo.org/wiki/Non_root_Xorg
    https://wiki.gentoo.org/wiki/Elogind
  7. reboot, 然后 startx 就只是提示没有 xterm 和 twm 了。
  8. emerge -av xterm twm,然后再 startx 就ok 了。
  9. loginctl 后面接不同参数实现不同功能,poweroff reboot suspend hibernate hybrid-sleep 这几个里面休眠还不能用,需要进一步配置,但是关机和重启是可以用的。
  10. 如果希望休眠和恢复增加 hook,可以 写脚本放入 /lib64/elogind/system-sleep/,具体参考: https://wiki.gentoo.org/wiki/Elogind
  11. 可以安装 x11-apps/mesa-progs 来测试 nvidia 显卡。 startx 以后,输入 glxinfo | grep direct 可以查看结果。 还可以运行 glxgears 来查看 fps.
  12. 如果 nvidia 内核模块进行了修改,那么修改了 /etc/modprobe.d/nvidia.conf 之后,还需要 update-modules,然后重新加载模块 modprobe -r nvidia modprobe nvidia

旧系统配置文件

配置文件主要在 /etc/X11/xorg.conf.d/.xinitrc , /etc/X11/Sessions/ 这几个里面。

i3wm

  1. echo ">=x11-wm/i3-4.18 doc" > /etc/portage/package.use/i3 给 i3wm 增加 doc
  2. emerge -av i3 dmenu i3status i3lock 安装 i3wm 相关的软件,其中 i3status 可以用功能更强的 i3blocks 代替,i3bar 可以用 polybar 来代替。
  3. ~/.xinitrc 里面写入 exec dbus-launch --exit-with-session i3 表示使用 i3 作为窗口管理系统。
  4. startx 启动 i3wm,选择默认首次配置地址,选择 win 按键作为 modifier 按键。

双显卡

可以参考 https://wiki.gentoo.org/wiki/NVIDIA/Optimus

参考:

https://wiki.gentoo.org/wiki/Xorg/Guide
https://wiki.gentoo.org/wiki/Non_root_Xorg
https://wiki.gentoo.org/wiki/NVIDIA/nvidia-drivers

gentoo 上面修改键盘映射分为两种,一种是终端环境,一种是X环境。

终端环境

https://www.emacswiki.org/emacs/MovingTheCtrlKey https://wiki.gentoo.org/wiki/Keyboard_layout_switching 参考里面的终端部分,从 /usr/share/keymaps/i386/qwerty/ 这个文件夹里面复制 us.map,解压 gunzip .map 然后修改里面的 control 对应的码, 然后另存为 us_ptz.map,并进行压缩,gzip .map 然后放到 /usr/share/keymaps/i386/qwerty/ 这个文件夹下面。

然后修改 /etc/conf.d/keymaps 这个文件,选择修改好的文件, 然后重启keymap, rc-service keymaps restart

按键可以通过 showkey 来获得对应的键值。

X环境

https://wiki.gentoo.org/wiki/Keyboard_layout_switching https://www.charvolant.org/doug/xkb/html/index.html http://blog.csdn.net/kl28978113/article/details/47955275

使用 setxkbmap 来管理X环境键盘布局 /etc/X11/Sessions/Xsession 这个文件可以看出使用 setxkbmap来对于 键盘布局进行管理。

setxkbmap -print -verbose 10 查看当前的 keymap

/usr/share/X11/xkb/keycodes/evdev 考虑了一下,最后直接修改 keycode里面的 evdev 文件,把里面的 caps和 RCTL替换,RTN和LCTL替换。

最近 gentoo 从 17.0 更新到 17.1, 需要手动进行升级配置,使用 unsymlink-lib -p --finish 这一步的时候报错,报错如下:

/usr/lib/python-exec/python3.6/unsymlink-lib -p --finish 

... 
rm -d /usr/lib64/go/test/fixedbugs/issue5957.dir/c.go 
rm -d /usr/lib64/go/test/fixedbugs/issue5957.dir/b.go 
rm -d /usr/lib64/go/test/fixedbugs/issue5957.dir/a.go 
rm -d /usr/lib64/go/test/fixedbugs/bug437.dir/one.go 
rm -d /usr/lib64/go/test/fixedbugs/bug437.dir/x.go 
rm -d /usr/lib64/go/test/fixedbugs/bug437.dir/two.go 
Traceback (most recent call last): 
  File "/usr/lib/python-exec/python3.6/unsymlink-lib", line 819, in <module> 
    main() 
  File "/usr/lib/python-exec/python3.6/unsymlink-lib", line 782, in main 
    m.finish(pretend=args.pretend, resume=args.action.endswith('resume')) 
  File "/usr/lib/python-exec/python3.6/unsymlink-lib", line 585, in finish 
    out('rm -d {}', fp) 
  File "/usr/lib/python-exec/python3.6/unsymlink-lib", line 41, in out 
    _log(template, *args, **kwargs) 
  File "/usr/lib/python-exec/python3.6/unsymlink-lib", line 30, in _log 
    **kwargs 
UnicodeEncodeError: 'ascii' codec can't encode character '\xc4' in position 50: ordinal not in range(128) 

我的 unsymlink-lib 的版本是 15,前面的一些 bug 已经修复了,所以检查 locale 的结果,结果发现是 locale 的问题, locale 都是 "POSIX",通过修改 /etc/env.d/02locale,

LANG="en_US.UTF-8" 
LC_COLLATE="C" 

然后 env-update && source /etc/profile,就解决问题了。

转自: https://www.jianshu.com/p/85d00246d1f0

在Ubunt的基本环境(Ubuntu上的软件基础--for NAS)搭建好以后,家庭多媒体中心的任务就摆在了面前。 参考了很多资料,Emby Server看起来是最好的选择,安装的过程很简单,网上有很多的教程,重点是我自己安装后不会用,下面就重点介绍一下安装以后的几种在小米盒子上看电影的方法。

- 阅读剩余部分 -

转自: https://emby.media/community/index.php?/topic/11176-gentoo-release/

ATTENTION: If you still have the old mediabrowser-server package installed be sure to switch to emby-server as 3.0.5572.0 will be the last update to this package! Also the library path for the emby-server package moved to /var/lib/emby-server!

Good news everyone! The linux package list for the server is growing! After the first debian/ubuntu package surfaced, now the gentoo package is on its way.

To use it fire up our all time favourite layman and add the overlay megacoffee:

layman -a megacoffee

Next up you should customize some options like file type support for imagemagick and ffmpeg to suit your needs by configuring use flags. Here's an example of suggested settings, you can put it as a file in /etc/portage/package.use/emby :

# this disables libgdiplus support in mono as we don't use it
dev-lang/mono minimal

# picture format support: jpeg, png and webp are needed, everything else is optional and may depend on your photos file formats
media-gfx/imagemagick jpeg jpeg2k png webp tiff

# the q8 setting is optional and speeds up image processing, if you have other tools using imagemagick you might want to disable this
media-gfx/imagemagick q8

# these are some basic ffmpeg runtime options that should always be enabled for performance reasons
media-video/ffmpeg vdpau vpx threads

# here you should define spport for all codecs you have in your video collection!
media-video/ffmpeg aac mp3 pic theora vorbis x264 xvid webp

After that you can install the package through

emerge -avND media-tv/emby-server

As the package depends on an version of mono that gentoo still consideres to be 'unstable' and the releases are fairly fresh, the packages are still architecture masked.

Architectures that should work are x86, amd64 and arm. I haven't been able to actually test the ebuild on ARM systems, so if you happen to have an ARM based gentoo box please drop me a line if it works all right. If you feel lucky you can also try this on any number of other architectures and let me know you have any problems.

Some things to know about the package:

If you are an inexperienced linux user and try to decide what kind of linux distro you want to use: do not use gentoo just because there is a emby package! Gentoo needs a good amount of time to correctly setup and grasp, so you propably will run into problems that you cannot fix on the first run, so be prepared! It will be installed to /opt/emby-server. The data directory defaults to /var/lib/emby-server but can be changed through the configuration in /etc/conf.d/emby-server.conf The newest mono release in the official tree is 3.2.8 and architecture masked. It is mostly stable though, so don't be shy to unmask it. If you want or need a more recent version use the overlay dotnet from the official layman list. The current recommendation is to use 3.10.0, as old versions have problems with SSL connections and 3.12.0 is a bit wonky on the stability side. If you already use an systemd enabled gentoo you won't have an init script ready for use (currently only the default OpenRC is supported here). Until I have been able to setup a test environment have a look at answer #9 in this thread. For more information about the overlay and contact options apart from this forum head over to http://gentoo-overlay.megacoffee.net/ Have fun and let me know if there are problems!

All ebuilds (including the dev ebuilds) have been updated and completed up to the current release.

I plan to provide updated ebuilds within a small amount of time from official releases so you should be covered.

For the dev (9999) ebuild: there will from time to time be problems with building it. As it builds the current in development snapshot this is to be expected.

If you plan to actually use mediabrowser and not just play around with it please refrain from using that ebuild!

yes the q8 problem is a bug in the current ebuild, it will be refreshed soon. Adding the q8 useflag is encouraged (speeds up image conversion), but not a necessity.

The codecs for ffmpeg depend on what media you are trying to use with emby. I deliberately didn't force any specific formats as long as emby itself doesn't need them, to avoid cluttering systems with codecs and other libraries that are not necessary. I will update the instructions to reflect those kind of pre-install changes though.

Q8 problem fixed, and updated first post with suggested use flag definitions. Have fun everyone! :)

As a heads up: in a future revision the default programData folder will move to /var/lib/!

Edit: revision 2 of the current release is up containing the folder move!

转自: http://gentoo-overlay.megacoffee.net/

At this unofficial place, we publish some ebuilds that may (or may not) be interesting to other Gentoo users. What we serve here are

ebuilds written by ourselves ebuilds that were already in official portage but needed some small change to build newer version ebuilds that we fetched from Gentoo Bugzilla at some point ebuilds with added patches of which some may have been written by us some may have been fetched from other sources such as bug trackers ebuilds that may have been removed previously from official portage - note that these may have been removed for a reason but this is for the special cases in which you simply just need them... All these ebuilds should be considered experimental. As we collect them from other sources (in accordance to the licenses), you are of course free to copy ours as well.

How to connect your Gentoo installation

The easiest way is to use layman to connect with us.

First, get mercurial and layman if you haven't done so already:

echo app-portage/layman mercurial >>/etc/portage/package.use
emerge layman # and follow instructions for /etc/make.conf

We are now on the official layman repository list, so all you need to do is:

  1. Run layman -f once to update the repository list.
  2. Add our overlay megacoffee to your local installation by running layman -a megacoffee - you should see an output similar to this:
    # layman -a megacoffee
    * Running... # /usr/bin/hg clone http://rhodecode.megacoffee.net/gentoo-overlay/main/ /var/lib/layman/megacoffee
    requesting all changes
    adding changesets
    adding manifests
    adding file changes
    added 12 changesets with 30 changes to 22 files
    updating to branch default
    20 files updated, 0 files merged, 0 files removed, 0 files unresolved
    * Successfully added overlay "megacoffee".
  3. From now on, run layman -S whenever you want to check for updates. If you're a long-time user of our repository, you may still have added http://gentoo-overlay.megacoffee.net/repositories.xml to your /etc/layman/layman.cfg. You can safely remove that entry now that we're on the default list.

最近想用 emby-server + kodi 打造家庭播放平台, 在 gentoo 上面先尝试安装配置 emby-server.

首先, 使用 megacoffee 这个 overlay, 这个上面支持 systemd 前的最后版本是 media-tv/emby-server/emby-server-3.2.70.0-r1.ebuild. 但是这个 overlay 使用 mercurial, 所以使用以下命令: vim /etc/portage/package.use/layman

app-portage/layman mercurial

然后, 安装 layman

emerge layman

然后 添加 overlay

layman -f
layman -a megacoffee
layman -S

其中 Run layman -f once to update the repository list, run layman -S whenever you want to check for updates.

然后按照下面的内容, 对应添加到 package.use 中去:

# this disables libgdiplus support in mono as we don't use it
dev-lang/mono minimal

# picture format support: jpeg, png and webp are needed, everything else is optional and may depend on your photos file formats
media-gfx/imagemagick jpeg jpeg2k png webp tiff

# the q8 setting is optional and speeds up image processing, if you have other tools using imagemagick you might want to disable this
media-gfx/imagemagick q8

# these are some basic ffmpeg runtime options that should always be enabled for performance reasons
media-video/ffmpeg vdpau vpx threads

# here you should define spport for all codecs you have in your video collection!
media-video/ffmpeg aac mp3 pic theora vorbis x264 xvid webp

然后, 安装 emby-server

emerge -avND media-tv/emby-server

可以使用下面语句启动 emby-server

rc-service emby-server start

使用下面语句开机自启动 emby-server

rc-update add emby-server default

启动 emby-server 之后, 使用浏览器进行配置, 输入 http://localhost:8096/web/wizardstart.html 进入配置界面. 安装顺序配置完成之后, 使用 http://localhost:8096/web/home.html 进入主界面.

emby-server 配置好以后, 在客户端的 kodi 中也需要配置. kodi 中需要安装 emby 的插件. 安装Emby Server插件的办法: Add-ons -> Add-on browser -> Install from repository -> All repositories -> Video add-ons -> 往下翻到E开头,就会找到Emby, 然后等待安装完成即可.