PND4

/dev/notes

Migrating to Systemd

Last night I stumbled upon systemd, freedesktop.org's set of services and scripts for the Linux System Base (LSB) to bring it up to userspace. Making good use of parallelization to beat its predecessor, sysvinit, it boots my laptop up in less than 10 seconds from grub to login-prompt and Im not even using a Solid State Drive (SSD).. Needless to say, I've been happy with its performance but Ive only been running it on my system for less than 24-hrs and there's still some tweaks need to be made to make a clean and full transition. I really hope more distro's make the migration natively, and it seems that my sentiments are shared in the community.

Without further ado, here are my notes:

Lets begin by installing the systemd package

Manually add *init=/bin/systemd *to your grub config.

Setup native systemd configuration files

1
# echo "your-hostname" > **/etc/hostname**
1
2
3
4
**/etc/vconsole.conf**
KEYMAP=us
FONT=lat9w-16
FONT_MAP=8859-1_to_uni
1
2
3
**/etc/locale.conf**
LANG=en_US.UTF-8
LC_COLLATE=C
1
# echo "America/Los_Angeles" > **/etc/timezone**

Once the previous steps are complete, you're all clear to reboot. Hopefully all went well and you'll be able to see some drastic speed improvements over sysV. Now all thats left is some optional steps to stay in good, proper form and possibly tweaking of services like syslog-ng which has been deprecated in favor of journalctl (which ships with systemd).

[Optional] By default, running a syslog daemon is no longer required. To read the log, use:

1
# journalctl

The journal writes to /run/systemd/journal, meaning logs will be lost on reboot. For non-volatile logs, create /var/log/journal/:

1
# mkdir /var/log/journal/

[Optional] Replace acpid with systemd mechanisms by uncommenting these from /etc/systemd/logind.conf“

  • HandlePowerKey : Power off the system when the power button is pressed

  • HandleSleepKey : Suspend the system when the sleep key is pressed

  • HandleLidSwitch : Suspend the system when the laptop lid is closed

[Optional] After a successful reboot, you can clean up by

  • removing packages pertaining to sysV (i.e.** sysvinit, initscripts**)

  • remove the init=/bin/systemd *from your grub.cfg if you used the *systemd-sysvcompat transitional package.

X11 Over SSH Tunnel

Conventions

  • Server - aka headless. Where X apps will be run on.

  • Client - aka laptop. Where apps will be shown.

Setting up the Server:

Start by running sshd and configuring /etc/ssh/sshd_config

  • Enable the AllowTcpForwarding option in ssh**d**_config on the server.

  • Enable the X11Forwarding option in ssh**d**_config on the server.

  • Set the X11DisplayOffset option in ssh**d**_config on the server to 10.

  • Enable the X11UseLocalhost option in ssh**d**_config on the server.

Restart the server

Check /etc/hosts and make sure it has been configured with correct hostnames and IPs.

Setting up the Client

Configure /etc/ssh/ssh_config

  • Enable the ForwardX11 option in ssh_config on the client.

  • Or.. just use "ssh -X" [or -Y for X11 Trusted Forwarding] when you ssh into the server (for security)

Testing

SSH into the server with "ssh -X user@10.0.0.1" and then run an X application such as xeyes, xterm, xclock, et cetera.. and enjoy.

Intel Graphics and early-KMS

Since just about every laptop or netbook I've come into contact with has a Intel motherboard, I figured this topic should be covered to get the most out of your hardware, improve your overall experience, and simply enough, to do things right. I had to learn a little bit about KMS myself recently because sometimes things dont work out-of-the-box.

You want to enable KMS because it allows the kernel to set the native resolution on the frame-buffer. The effects of this are fast TTY-switching, enhanced 3D performance, and in some cases power-saving features.

In order to enable KMS on the Intel mobile platform some changes possibly have to be made to your Kernel, X installation, bootloader, and startup configuration.

Kernel changes may only be necessary if you compiled your own (aka gentoo). In which case, simply enable the frame-buffer options:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
Device Drivers --->
  Graphics support --->
    Support for frame buffer devices --->
    (Disable all drivers, including VGA, Intel, nVidia, and ATI)

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

    /dev/agpgart (AGP Support) --->
      <*>  Intel 440LX/BX/GX, I8xx and E7x05 chipset support
      Direct Rendering Manager (XFree86 4.1.0 and higher DRI support) --->
      <*>  Intel 8xx/9xx/G3x/G4x/HD Graphics
      [*]    Enable modesetting on intel by default

*Xorg *'s only requirement is that we install it and the proper xf86-video-intel driver package.

Bootloader changes are done so that our grub does not disable, use another driver, or try to set the resolution itself. Remember, we are letting the Kernel do this for us. so edit your /etc/default/grub and remove any of the following:

  • Any "nomodeset", "i915.modeset=0", "vga=" or "video=" at all present.

  • Anything that would enable another frame-buffer driver such as uvesafb.

Start-up configuration must reflect our efforts so that KMS is started early on in the process as possible to get the best effect. changes should be made to /etc/mkinitcpio.conf in Arch, or /etc/conf.d/modules in Gentoo to include the i915 module.

Finally regen your initial-ramdisk if you used one and your boot partition's GRUB config.

1
2
3
4
## make initrd
# mkinitcpio -p linux
## generate a GRUB config
# grub-mkconfig -o /boot/grub/grub.cfg

Reboot and [hopefully] reap the fruits of all your hard work.