lördag 5 oktober 2013

Howto: Install systemd in gentoo linux

This is how i installed Systemd in gentoo linux.

http://www.freedesktop.org/wiki/Software/systemd/
http://wiki.gentoo.org/wiki/Systemd
https://wiki.archlinux.org/index.php/Systemd
https://dornea.nu/blog/2013/08/gentoo-systemd-consolekit-udev-and-some-failed-system-update
https://wiki.archlinux.org/index.php/Improve_Boot_Performance


Most up to date Systemd  REQUIREMENTS:
http://cgit.freedesktop.org/systemd/systemd/tree/README#n36

REQUIREMENTS:
        Linux kernel >= 3.0
          CONFIG_DEVTMPFS
          CONFIG_CGROUPS (it's OK to disable all controllers)
          CONFIG_INOTIFY_USER
          CONFIG_SIGNALFD
          CONFIG_TIMERFD
          CONFIG_EPOLL
          CONFIG_NET
          CONFIG_SYSFS

        Linux kernel >= 3.8 for Smack support

        Udev will fail to work with the legacy layout:
          CONFIG_SYSFS_DEPRECATED=n

        Legacy hotplug slows down the system and confuses udev:
          CONFIG_UEVENT_HELPER_PATH=""

        Userspace firmware loading is deprecated, will go away, and
        sometimes causes problems:
          CONFIG_FW_LOADER_USER_HELPER=n

        Some udev rules and virtualization detection relies on it:
          CONFIG_DMIID

        Mount and bind mount handling might require it:
          CONFIG_FHANDLE

        Support for some SCSI devices serial number retrieval, to
        create additional symlinks in /dev/disk/ and /dev/tape:
          CONFIG_BLK_DEV_BSG

        Optional but strongly recommended:
          CONFIG_IPV6
          CONFIG_AUTOFS4_FS
          CONFIG_TMPFS_POSIX_ACL
          CONFIG_TMPFS_XATTR
          CONFIG_SECCOMP

        For systemd-bootchart a kernel with procfs support and several
        proc output options enabled is required:
          CONFIG_PROC_FS
          CONFIG_SCHEDSTATS
          CONFIG_SCHED_DEBUG

        For UEFI systems:
          CONFIG_EFI_VARS
          CONFIG_EFI_PARTITION

        Note that kernel auditing is broken when used with systemd's
        container code. When using systemd in conjunction with
        containers please make sure to either turn off auditing at
        runtime using the kernel command line option "audit=0", or
        turn it off at kernel compile time using:
          CONFIG_AUDIT=n

Create  /etc/portage/profile/use.force with -consolekit.
$ cat /etc/portage/profile/use.force
-consolekit

Create /etc/portage/profile/use.mask with consolekit and -systemd.
$ cat /etc/portage/profile/use.mask
consolekit
-systemd

Add to package.use.
$ cat /etc/portage/package.use
sys-fs/udisks systemd
sys-auth/polkit systemd
sys-auth/pambase systemd

When you install systemd you must have desktop profile set.

# eselect profile list
Available profile symlink targets:
  [1]   default/linux/amd64/13.0
  [2]   default/linux/amd64/13.0/selinux
  [3]   default/linux/amd64/13.0/desktop *
  [4]   default/linux/amd64/13.0/desktop/gnome
  [5]   default/linux/amd64/13.0/desktop/kde
  [6]   default/linux/amd64/13.0/developer
  [7]   default/linux/amd64/13.0/no-multilib
  [8]   default/linux/amd64/13.0/x32
  [9]   hardened/linux/amd64
  [10]  hardened/linux/amd64/selinux
  [11]  hardened/linux/amd64/no-multilib
  [12]  hardened/linux/amd64/no-multilib/selinux
  [13]  hardened/linux/amd64/x32
  [14]  hardened/linux/uclibc/amd64


"OPS" It is very  important you don't reboot without one or the other installed. The results would be rather unfortunate.

I use xfce4 and that means only remove udev. Consolekit get removed with above settings.
emerge -C udev

Install systemd first then add systemd to make.conf.
emerge -1av systemd

Add systemd to make.conf.
USE="-gnome -kde -minimal -qt4 -consolekit -pulseaudio systemd

Update your system.
emerge --keep-going  --update --newuse --ask --deep --with-bdeps=y @world

Add systemd to grub2.
GRUB_CMDLINE_LINUX="init=/usr/lib/systemd/systemd"

Mine looks like this.
GRUB_CMDLINE_LINUX="quiet  audit=0  ipv6.disable=1 init=/usr/lib/systemd/systemd"

Done with systemd and reboot.

------------------------------------------------------------------------------------------------------

Now fix little things after :)

Check here again.
https://wiki.archlinux.org/index.php/Systemd
http://wiki.gentoo.org/wiki/Systemd
------------------------------------------------------------------------------------------------------

http://www.freedesktop.org/wiki/Software/systemd/PredictableNetworkInterfaceNames/
Start Network
systemctl enable NetworkManager
systemctl start NetworkManager

If you have dhcpcd.
systemctl enable dhcpcd.service

If it doesn´t work
systemctl enable dhcpcd@interface_name.service

If you use dhclient.
User raddaqii in gentoo forums post this.
https://forums.gentoo.org/viewtopic-t-972608.html

If you want to have static ip look there.
https://wiki.archlinux.org/index.php/Network_Configuration#Static_IP_address

If you have a wpa_supplicant.
https://wiki.archlinux.org/index.php/WPA_supplicant#Enabling_with_systemd

-----------------------------------------------------------------------------------------------------

If you have trouble with mounting usb ,burning with dvd.not login to tty  a.s.o,
check if your user-session is active. (google have alot from arch linux forum)

https://wiki.archlinux.org/index.php/Systemd/User

$ loginctl --no-pager show-session $XDG_SESSION_ID | grep Active
Active=yes

$ loginctl show-session $XDG_SESSION_ID active

Id=c5
Timestamp=Sat 2013-10-05 13:13:55 CEST
TimestampMonotonic=93942897
VTNr=7
Display=:0
Remote=no
Service=lightdm
Scope=session-c5.scope
Leader=2364
Audit=0
Type=x11
Class=user
Active=yes
State=active
IdleHint=no
IdleSinceHint=0
IdleSinceHintMonotonic=0
Name=croutch

I fix this with the simplest solution. I installed lightDM displaymanager.
https://wiki.archlinux.org/index.php/LightDM

systemctl enable lightdm

If you want to have another display manager.
Enable with.

for kdm
systemctl enable kdm.service
systemctl start kdm.service

for gdm
systemctl enable gdm.service
systemctl start gdm.service

-----------------------------------------------------------------------------------------------------

If you have a large /home partition, it might be better to allow services that do not depend on /home to start while /home is checked by fsck. This can be achieved by adding the following options to the /etc/fstab entry of your /home partition.

noauto,x-systemd.automount

-----------------------------------------------------------------------------------------------------

Readahed section here before.

https://www.mail-archive.com/systemd-devel@lists.freedesktop.org/msg21693.html

----------------------------------------------------------------------------------------------------

Early start for services

One central feature of systemd is D-Bus and socket activation. This causes services to be started when they are first accessed and is generally a good thing. However, if you know that a service (like UPower) will always be started during boot, then the overall boot time might be reduced by starting it as early as possible. This can be achieved (if the service file is set up for it, which in most cases it is) by issuing.

# systemctl enable upower

----------------------------------------------------------------------------------------------------

After install i would recommend if you still have openrc installed  but wants systemd to take care of how programs starts. And maby save some time on boot.
To check in terminal - rc-update show.

I removed to start with.

dbus
networkmanager
alsa
syslog-ng (uninstalled)

----------------------------------------------------------------------------------------------------


Systemd comes with a rumour to boot fast and that is all true.

Look at this thread at arch linux forums. This thread is very good and you got many tips and trix from other users.

Post your systemd startup times
https://bbs.archlinux.org/viewtopic.php?id=147841


Command in terminal : systemd-analyze && systemd-analyze blame

or like me in .bashrc

alias sys='systemd-analyze && systemd-analyze blame'

And here you have my boot times at the moment.
Startup finished in 4.997s (firmware) + 961ms (loader) + 1.128s (kernel) + 535ms (userspace) = 7.622s

Whats interest are those numbers :)  and yes i have an intel 180g ssd.
Startup finished in 1.128s (kernel) + 535ms (userspace) =1.633

----------------------------------------------------------------------------------------------------

And if you have an more advanced setup with encryption,initramfs.You should look at user nlsa8z6zoz7lyih3ap´s thread on gentoo forums.
https://forums.gentoo.org/viewtopic-t-972332.html

----------------------------------------------------------------------------------------------------

croutch

tisdag 17 september 2013

Howto: Change spotify font size in gentoo linux.

Sometimes you find tips and trix on the web that are amazing. This was exactly what i was looking for and fits my 50T plasma TV perfect.

All credits to jkx for his guide http://www.larsen-b.com/Article/446.html

Spotify use a skin for the client , so changing QT4 fonts doesn’t change anything, we have to fix the skin directly.

This is how you do it in gentoo linux. Before you start remember to do backups.

You need  python and /dev-python/elementtree


1. Search the file resources.zip in /opt/spotify/spotify-client/Data/ . Extract the file skin.xml.

2. Create dir /opt/spotify/spotify-client/Data/unpack and extract resources.zip to it

3. Create a python file with name spotify.py and and past this in - 
(if you have problem with the script,put a b to the right of the 'w' in this line - 
file = open("new_skin.xml", 'w') 
from this bug http://bugs.python.org/issue9458


import xml.etree.ElementTree as xml

tree = xml.parse("./skin.xml")
root = tree.getroot()

for f in root.findall('font'):
 taille = f.get('size')
 if taille:
  taille = int(taille) + 4
  f.set('size',str(taille))


file = open("new_skin.xml", 'w')

xml.ElementTree(root).write(file)


4. After your run spotify.py you should have a file named new_skin.xml. Rename it to skin.xml and put it in unpack dir.


5. Repack resources.zip with command - zip -r resources *


6. Copy resources.zip back  to /opt/spotify/spotify-client/Data/

7. Reboot computer and start spotify 




lördag 7 september 2013

Howto: Install grub2 with "uefi" in gentoo linux.


I used refind bootloader as my boot-tool in a very long time. But i had very much trouble with it in the end
and switch over to grub2 instead. And i never had any boot problem at all since then.

I create  my partitions with  http://gparted.sourceforge.net/livecd.php and i use GPT partitions.
You must go to advanced mode and change to gpt before you create your partitions.
I have like this:
bios_grub 50M = vfat = Set bios_grub flag after creation of the partitions.
/boot/efi 512M = vfat = Set boot flag after creation of the partitions.
/
/home

# Before chroot
modprobe efivars


# EFI kernel settings

CONFIG_EFI=y
CONFIG_FB_EFI=y
CONFIG_FRAMEBUFFER_CONSOLE=y
CONFIG_EFI_PARTITION=y
CONFIG_EFI_VARS=y
CONFIG_EFI_STUB=y

Optional- I not use these two
CONFIG_RELOCATABLE=y
CONFIG_CMDLINE="root=/dev/sda3"

Install gentoo the way you do and when you chrooted in and are to install grub2.

Set:
grep -v rootfs /proc/mounts > /etc/mtab

Set GRUB_PLATFORMS in /etc/portage/make.conf (optional). If unset, grub will guess which platform you want. It guesses "pc" for x86 / amd64.

# UEFI on amd64
GRUB_PLATFORMS="efi-64"

# UEFI and PC
GRUB_PLATFORMS="efi-64 pc"

echo 'LABEL=efi-boot /boot/efi vfat defaults 0 2' >> /etc/fstab
root #
mount /boot/efi
root #
mkdir -p /boot/efi/{EFI/BOOT,GRUB}

emerge --ask sys-boot/grub

grub2-install --target=x86_64-efi --efi-directory=/boot/efi --boot-directory=/boot/efi

grub2-mkconfig -o /boot/efi/GRUB/grub.cfg

 ----------------------------------------------------------------------------------------------------------------------

 "OBS" Grub2 has change name to grub.

If you already sit with grub2 and want to switch to new grub instead just remove GRUB2DIR in /boot/efi/GRUB2.

mkdir -p /boot/efi/grub

And install 
emerge --ask sys-boot/grub
grub2-install --target=x86_64-efi --efi-directory=/boot/efi --boot-directory=/boot/efi

grub2-mkconfig -o /boot/efi/GRUB/grub.cfg

Done

 ----------------------------------------------------------------------------------------------------------------------------
sources
http://wiki.gentoo.org/wiki/GRUB2#UEFI.2FGPT
http://wiki.gentoo.org/wiki/GRUB2_Quick_Start



croutch