Brix media center Linux installation notes

This post was written by eli on March 12, 2017
Posted Under: DVB,Linux

Intro

These are my jots as I installed Linux Mint 18.1 on a Gigabyte GB-BACE-3160 Compact PC with a 240 GB SSD hard disk and 8 GB RAM, for the purpose of driving my TV in the living room. Not all issues are solved yet.

General notes

  • Use ssh -X. It allows X-windows to open on the calling computer.
  • Uname: Linux tv 4.4.0-53-generic #74-Ubuntu SMP Fri Dec 2 15:59:10 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
  • Mint 18.1 (“Serena”) is a derivative of Ubuntu 16.04 (“Xenial”). This can be verified by looking at /etc/apt/sources.list.d/official-package-repositories.list.
  • There are a lot of intel_* utilities to look at installed.
  • Unsolved problem: System boots up with kswap0 taking 100% CPU, and no desktop comes up. The problem seems to be that since there’s no swap on my system + the “cinnamon” process running at 100%, requesting more and more memory until it runs out, and kswap0 tries to fix it.
    WORKAROUND: Kill, as root, the “mdm” process, father of the X window tree. This restarts cinnamon.
    Bad omen: cinnamon gets stuck sometimes and sometimes not, even in subsequent overlayfs mode bootups (so all files in the filesystems were the same initially).
    There is nothing that stands out in .xsession-errors on a failed boot vs. a successful one (from cold or after killing mdm).
  • There’s still an issue with mouse pointer traces (in particular going on and off the shutdown confirmation dialog box), and it seems to be an HDMI-only issue. The disappearing and sluggish mouse seems to have been solved by disabling the splash on Grub (which plays with the DRM).
  • Desktop background image:
    $ gsettings get org.gnome.desktop.background picture-uri
    '/usr/share/backgrounds/linuxmint/default_background.jpg'

Installation flow

  • BIOS is invoked by pressing the “Delete” button (constantly) during powerup
  • Changed the OS in the BIOS to Linux (not clear why it matters)
  • Always power on when AC power is applied: In the BIOS menu, Chipset > Restore AC Power Loss set to “Power on”.
  • Pushed USB stick with Linux Mint 18.1 Cinnamon. Booted with no issues
  • Installed ssh for remote access (ssh daemon starts immediately after installation)
    # apt-get update
    # apt-get install ssh
    # passwd mint
  • Set partition table manually: First partition for boot, 250 MB. Second partition for LVM, 120 GB. Leaving half the disk unpartitioned. LVM can easily use disk space from another partition in the future, if that’s needed. So it read in the end (fdisk):
    Command (m for help): p
    Disk /dev/sda: 223.6 GiB, 240057409536 bytes, 468862128 sectors
    Units: sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disklabel type: dos
    Disk identifier: 0x34449fd0
    
    Device     Boot  Start       End   Sectors  Size Id Type
    /dev/sda1         2048    514047    512000  250M 83 Linux
    /dev/sda2       514048 252172287 251658240  120G 8e Linux LVM
  • Created one big logical volume on /dev/sda2:
    # pvcreate /dev/sda2
      Physical volume "/dev/sda2" successfully created
    # vgcreate vg_ssd2 /dev/sda2
      Volume group "vg_ssd2" successfully created
    # lvcreate vg_ssd2 -l 100%FREE -n lv_root
      Logical volume "lv_root" created.
  • Launched the “Install Linux Mint”
  • During installation, enabled installation of third party software (mp3 and media stuff). Installation type: “Something else” to pick what goes where. No swap partition. Installation went through cleanly
  • Installed git (“apt-get install git”) and created a repository in root
  • Installed the ssh daemon (apt-get install ssh)
  • Stop the Linux splash. Give me some real boot text output, and this probably also solves some weird issues with the graphics card (mouse pointer traces and sluggish mouse response?):
    Edit /etc/default/grub, changing GRUB_CMDLINE_LINUX_DEFAULT=”quiet splash” to GRUB_CMDLINE_LINUX_DEFAULT=”", and then update the actual GRUB2 file from the /etc/grub.d and the file just edited into /boot/grub/grub.cfg 

    # update-grub
  • Also, make Grub’s menu always appear, since pressing Shift at bootup doesn’t work on this platform. So edit /etc/default/grub once again, uncommenting (explained in Ubuntu’s GRUB2 doc):
    GRUB_HIDDEN_TIMEOUT=0

    and setting

    GRUB_TIMEOUT=2
    GRUB_RECORDFAIL_TIMEOUT=2

    and once again, run update-grub. The GRUB_RECORDFAIL_TIMEOUT part is required for all the times the computer is turned off abruptly (which is fine with an overlayfs). Otherwise GRUB sticks to 30 seconds all the time.

    For more advanced GRUB trickery, see this post.

  • DIDN’T: The kernel console boot output is given with some weird blocks instead of characters (The Matrix style) until the framebuffer module is initialized, and the screen goes into graphical mode, after which all looks OK. This can be fixed by uncommenting
    #GRUB_TERMINAL=console

    in /etc/default/grub, and running update-grub. The result is that these two seconds of kernel messages that are OK, but GRUB’s own menu is shown painfully slow. So I remain with the Matrix kernel.

  • Ditch Apparmor, because it messes up things with overlayroot, and probably would cause all kind of weirdnesses regardless, exactly like SELinux did in the past (no chkconfig in Xenial).
    $ sudo update-rc.d apparmor remove
  • Fix /bin/sh symlink: By default, it goes to /bin/dash (someone had a bad sense of humor). Change it /bin/bash. Won’t make any difference in the matters of this post, but it will bite sometime in the long term.
  • Add LSB (Linux Standard Base), among others for getting  ld  symlinks in /lib64/. Once again, won’t make any difference right now, but it should be there:
    # apt-get install lsb-core
  • Add group eli manually:
    # addgroup --gid nnn eli
  • And user:
    # adduser --gid nnn --uid nnnn eli
    Adding user `eli' ...
    Adding new user `eli' (nnnn) with group `eli' ...
    Creating home directory `/home/eli' ...
    Copying files from `/etc/skel' ...
  • Allow no-password access of all members of sudo group (only added NOPASSWD part). From /etc/sudoers:
    %sudo   ALL=(ALL:ALL) NOPASSWD: ALL
  • Enable auto login: Pick the “Login Window” GUI application
  • Assign a fixed address on DHCP daemon and a host name at /etc/hosts
  • Install NFS client:
    # apt-get install nfs-common
  • Copy my own .bashrc stuff into “eli” and “root” users
  • Install Xemacs:
    # apt-get install xemacs21
  • Allowing X-sessions over ssh from root user, following this post. As root,
    # xauth merge /home/eli/.Xauthority
    xauth:  file /root/.Xauthority does not exist
    # cd ~/
    # ln -s /home/eli/.Xauthority

    Note that I symlinked the file only because it didn’t exist before, and copying it makes the trick only until the next reboot.

  • Set the power options (never turn off screen) and screensaver (ditto, it’s done separately)
  • Install kodi, MythTV and mplayer (vlc was already installed):
    $ sudo apt-get install --install-suggests kodi
    $ sudo apt-get install --install-suggests mythtv
    $ sudo apt-get install --install-suggests mplayer
  • Install PVRs (mythtv and dvbviewer were probably redundant)
    # apt-get install kodi-pvr-iptvsimple
    # apt-get install --install-suggests kodi-pvr-dvbviewer
    # apt-get install kodi-pvr-mythtv
    # apt-get install kodi-pvr-hts
  • Install DVB command-line utilities, which didn’t prove very useful (previously dvb-utils)
    # apt-get install dvb-apps
  • Install w_scan, useful for DVB channel scanning
    # apt-get install w-scan
  • After changing the resolution to 1920x1080 the menu panel at the bottom was too low down, making it almost invisible. This was the Samsung monitor’s fault, which needed to be adjusted to show the full screen.
  • (No need to install kernel headers nor Make / compiler. All included out of the box)
  • Install apt-file:
    $ sudo apt-get install apt-file
    $ apt-file update
  • Installed intel-graphics-update-tool_2.0.2 (I messed up a bit with it, see below. Problem was that I attempted to install 2.0.3, which relates to Ubuntu 16.10, but Mint 18.1 is Ubuntu 16.04). It refused, as it looked at /etc/lsb-release, founding out that the distro is Mint. So I faked it.
    $ sudo dpkg -i intel-graphics-update-tool_2.0.2_amd64.deb
    $ sudo apt-get -f install
    $ sudo intel-graphics-update-tool
  • Some DVB command line tests (see separate post)
  • Overlay root (see separate post)
  • Turn off ureadahead service (for faster boot, but does it make sense on a SSD device?)
    # systemctl disable ureadahead
  • Install Tvheadend (see separate post)
  • Add Kodi and Terminal as Startup Applications (using the desktop’s Menu > Startup Applications). Don’t. It’s important to see the desktop screen so the computer’s mode is clear.

Kodi setup

General note: Kodi remembers the navigation position in sub-menus when a category is entered. If things get too confusing, just restart Kodi, so the navigation paths in the docs match.

  • Change setting level to Advanced
  • System > Settings > Enable TV
  • Enable and Configure PVR IPTV Simple Client with a local file playlist (System > Settings > Add-ons > My add-ons > PVR Clients > PVR IPTV Simple Client). Grab a playlist from http://localhost:9981/playlist and append hand-picked entries. In the EPG Settings tab, set Location to Remote Path, and XMLTV URL to http://localhost:9981/xmltv. This requires a recent (post-4.0.9) version of Tvheadend.
  • On exit, use Ctrl-Alt-F1 and then Ctrl-Alt-F7 to get back from the blank screen it leaves (if necessary)
  • Don’t install a TVheadend plugin. It got the original Tvheadend stuck, and the newer one requires picking a channel twice to view it. Besides, the Simple Client covers all needs with a single playlist.

Fixing graphics issues

Downloaded intel-graphics-update-tool_2.0.3_amd64.deb from Intel Graphics for Linux and ran

$ sudo dpkg -i intel-graphics-update-tool_2.0.3_amd64.deb

but that failed due to a dependency problem:

Selecting previously unselected package intel-graphics-update-tool.
(Reading database ... 207385 files and directories currently installed.)
Preparing to unpack intel-graphics-update-tool_2.0.3_amd64.deb ...
Unpacking intel-graphics-update-tool (2.0.3) ...
dpkg: dependency problems prevent configuration of intel-graphics-update-tool:
 intel-graphics-update-tool depends on libpackagekit-glib2-18 (>= 0.9.4); however:
  Package libpackagekit-glib2-18 is not installed.
 intel-graphics-update-tool depends on fonts-ancient-scripts; however:
  Package fonts-ancient-scripts is not installed.

dpkg: error processing package intel-graphics-update-tool (--install):
 dependency problems - leaving unconfigured
Processing triggers for gnome-menus (3.13.3-6ubuntu3.1) ...
Processing triggers for desktop-file-utils (0.22-1ubuntu5) ...
Processing triggers for mime-support (3.59ubuntu1) ...
Errors were encountered while processing:
 intel-graphics-update-tool

Rumor has it that apt-get -f install can fix that, but it said:

$ sudo apt-get -f install
Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... Done
The following packages will be REMOVED:
  intel-graphics-update-tool
0 upgraded, 0 newly installed, 1 to remove and 128 not upgraded.

Remove? Why? What have I done? How about this:

$ sudo apt-get install --fix-missing
Reading package lists... Done
Building dependency tree
Reading state information... Done
You might want to run 'apt-get -f install' to correct these.
The following packages have unmet dependencies:
 intel-graphics-update-tool : Depends: libpackagekit-glib2-18 (>= 0.9.4) but it is not installable
                              Depends: fonts-ancient-scripts but it is not installed

So I ran apt-get -f install and dropped intel-graphics-update-tool.

Directories that change

In the event of restoring the entire root filesystem from backup, try to retain these:

  • /.git (the main git repository)
  • /home/eli (of course)
  • /home/eli/.kodi (included in /home/eli, but this is where Kodi keeps its info)
  • /home/hts/ (where Tvheadend keeps its settings and logs)

Add a Comment

required, use real name
required, will not be published
optional, your blog address

Previose Post: