Pages

Showing posts with label kernel. Show all posts
Showing posts with label kernel. Show all posts

2015-10-18

Lenovo S20-30 Touch + Crux 3.1

PART 3  | See Part 2 and Part 1

So, Crux is meant to be keeper. And this post will be long and occasionally detailed - as Crux' manual is not very long and help is only in form of mailing-list.

Made usb installer: dd if=crux-3.1.iso of=/dev/sdd bs=1M, booted and had auto-login as root.
Did whole fdisk /dev/sda, mkswap/swapon, mkfs -t ext4 /dev/sda2 (and sda3) again.
mount /dev/sda2 /mnt    #sda1=swap, sda2=/, sda3=all stuff
setup

Picked packages manually - left some things out. Installer finished with no errors and then it was time to chroot.
It's not particularly important in which order you do things when chrooted - and some of following can also be done after reboot.
setup-chroot  #script with all needed chroot-things
passwd  #create root password
adduser myuser  #can be done later but I did then
mkdir /media/back  #mount point for sda3
chown myuser:users /media/back
nano /etc/fstab  #has to be fixed, otherways - no boot.
nano /etc/rc.conf  #can be done later, but why wait:
FONT= default
KEYMAP=us   #all availables are in /usr/share/kbd/keymaps
TIMEZONE=Narnia/Mytown  # /usr/share/zoneinfo/
HOSTNAME=cruxlap
SYSLOG=sysklogd
SERVICES=(crond net)  #here go all started services, e.g: alsa gpm ntp sshd
localedef -i en_US -f UTF-8 en_US.UTF-8
cp /usr/share/zoneinfo/America/Yourplace /etc/localtime
hwclock --set --date="2012-04-19 16:45:05" --localtime
hwclock --hctosys

# I have habit to use localtime - because of windows dualboot in my desktop-machine. If Linux is single-system, then it's no problem using UTC.

Created udev/rules.d/70-persistent-net.rules with card mac number as eth0 - otherways udev changes card-name to something - and net is not going to load automatically on boot.

Kernel compilation.
Thought to be clever - and compiled newer kernel (3.18.22) than one provided by Crux. Well, it hanged when booting. Tried changing things / recompiling - but nothing worked. Copied confs to sda3 and reinstalled Crux (to be safe of leftovers). Copied confs back, and compiled original kernel.
Which booted alright. But - surely I was in some totally retarded mode - as I left Intels' video driver out. Recompile. Then I discovered that I left out also sound drivers. Recompile. And afterwards I discovered that I left out i2c - needed by coretemp... well, not essential - no recompile.
Anyway, compiling went exactly like it's written in Crux' page:
cd /usr/src/linux-3.12.24
make menuconfig
make all
make modules_install
cp arch/x86_64/boot/bzImage /boot/vmlinuz
cp System.map /boot


grub-install /dev/sda  &&  grub-mkconfig > /boot/grub/grub.cfg
I didn't like what grub created - so I made my own simple cfg file (can be copied from Crux' page, and then modified).
Copied all my desktop-Crux user-confs to laptop and changed ownership to my user.
exit && reboot

mount /dev/sda3 /media/back  #if not already in fstab
Before starting with updates I changed ports confs - made /media/back/ports and media/back/pac folders and edited /etc/pkgmk.conf and /etc/prt-get.conf accordingly. Also - every .rsync file in /etc/ports has to be changed too.
The point is - all sources+compilations grow very big, very soon. No need to stuff your root.
mv contrib.rsync.inactive contrib.rsync  #enable contrib, also in prt-get.conf
ports -u  #update ports list
prt-get sysup  #whole system upgrade - takes hours!

Only error I had was with xorg-server: missing libepoxy. Installed that and xorg compiled OK.

And then it was installing everything I normally do install. Troubles:

- gpm  # Only thing that worked was usb-mouse. Hacked /etc/rc.d/gpm:
/usr/sbin/gpm -m /dev/input/mice -t imps2
stop/start gpm and all touch-things started to function.
- openbox # cp /media/back/ports/openbox media/back/pac, then edited Pkgfile '--enable-imlib2 \' and also added imlib2 to depends line. The same goes for conky.
- xdotool  # Now there is package to be taken (1,5 years ago there wasn't)
- man needs pager - put into .bashrc: export pager='less'
- tint2 # has waken from long coma - and there is new version 0.12.2
Url in Pkgfile didn't work, though - the one in slackbuilds.org did, so I downloaded tar from there.  
- wmctrl  # url is slightly wrong - /dist has to be taken out.
- volumeicon 4.6  # last version with gtk2, needs patching.
- pale moon binary package to /opt, ln -s /usr/local/bin (I have a habit to put apps to local/bin... In Crux, this folder has to be created.)
- mplayer + smplayer  # Like previous time, there were severe problems. Basically , smplayer didn't play anything and whined about mplayer error. To cut it short - after almost 3 hours of aborted compilations I installed mpv, smplayer started to work with mplayer BUT not with mpv... &^%&#$$#^.
- compton  # Packages point to very old version. I dowloaded new git version but didn't succeed with make install (missing some dep). So I was impatient and ended up with just make and cp compton /usr/local/bin. And it works alright.
- mtpaint  # 3.40 doesn't compile - libpng-16 is too new for it. Git-version compiles ok.
- libunibreak  # is newer liblinebreak. There is no package in Crux - but it's easy to make. Fbreader needs it - and fbreaders' Pkgfile needs then fixing (liblinebreak out).
- libtorrent-rasterbar  # For qbittorrent. But - 1.0.5 from Pkgfile is a WRONG one. Qbittorrent needs 1.0.6 from git.
- qbittorrent  # Refused to make package (error - package is empty) - BUT at the same time - installed it.

And so on... Installing/upgrading Crux and adding your stuff takes 30 hours or probably more. But when all is done - it's real fast and lean. Exactly what fits with shity Celeron.

2015-01-18

Slackware64 14.1 + new kernel

Yeah, compiled a new 3.14.28 kernel - in a bit leaner way than slackware generic is.
So here comes concisely how I did it.

# First, open up this page and read it - my description here is almost the same, with occasional addons. And - I did everything on desktop terminal until Nvidia drivers' reinstall (logout, console, init 3).

1. Download the source (and pgp .sign) from kernel.org, copy to /usr/src, unxz the source file (tar needed afterwards), then unpack source to folder. To be nice and orderly, do: rm linux && ln -s /usr/src/linux-3.14.28 linux
cd linux
zcat /proc/config.gz > /usr/src/linux/.config  # or use some other handy config...
make oldconfig  # to insert kernel changes into old config file.
make menuconfig # Which probably takes two hours at least. But it's worth to be alert and click everything - for not to miss, for example, your network drivers.
make bzImage modules
make modules_install
cp arch/x86/boot/bzImage /boot/vmlinuz-custom-3.14.28
cp System.map /boot/System.map-custom-3.14.28 
cp .config /boot/config-custom-3.14.28
  # instead of 'custom' comes of course your special name you gave to your kernel (when menuconfiging).
/usr/share/mkinitrd/mkinitrd_command_generator.sh -k 3.14.28
This nicy script gives you exact command for creating initrd. Do it.
cd /boot
There should be three links to: kernel, system.map and config. Change those to point to your new files (ln -sf filename link).
Done with the kernel.

2. There is link /etc/rc.d/rc.modules which points to old rc.modules-3.10.17; copy this old modules file, rename it according to new kernel modules folder name (or 'uname -r' - which you can't use as kernel is not yet installed :) and change rc.modules link to point to this new file.

3. Grub or Lilo - has to be rerun for introducing new kernel. I have Grub2 in Wheezy (which I still keep only for hosting my multiboot) - I mounted Wheezys' partition and simply edited /boot/grub/grub.conf file. And that was that.

4. GPG-check. (Additionally to AlienBobs' tutorial there is also nice explanation in kernel.org.)
wget http://www.kernel.org/pub/linux/kernel/v3.0/linux-3.14.28.tar.sign
Put it into the same folder where you have linux-3.14.28.tar
gpg --verify linux-3.14.28.tar.sign linux-3.14.28.tar
What results 'no key', but there is id=6092693E , use this and import:
gpg --keyserver hkp://keys.gnupg.net --recv-keys 6092693E
gpg --verify linux-3.14.28.tar.sign linux-3.14.28.tar
"This key is not certified with a trusted signature" - let it be like that, done.

5. NVIDIA
Kernel 3.14 and nvidia 319, seems, are not friends - no compile, BUT newer 331.86 did the trick. Before run, delete /etc/X11/xorg.conf - and then let installer make a new one. Sometimes there is a difference - as X starting or not starting (missing screens). No, I do not know why it sometimes matters.
Last part in following is for compiling for not yet installed kernel.
sh NVIDIA-Linux-x86_64-331.89.run --kernel-name='3.14.28'
It compiled, but whined over wrong arch in  /usr/lib64/libEGL.la
Anyway - X started up. I checked aforementioned .la - and it appeared that Nvidia removed it totally. Found it in /var/log/nvidia/103, copied back and also deleted in it one dependency that was obviously 32bit... We'll see what happens next time when compiling.
According to web, reinstalling mesa also fixes .la issue.

But never mind.
I have my new kernel running and everything seems to function OK.

2014-05-16

Crux 3.0 - 1: Install

Visiting fringes chapter 3. See 1 and 2
http://crux.nu

Now - including Crux to fringes is a lot misleading, especially after pitiable three in 'Fringes 2'. Crux is totally OK source-based distro, pleasantly conservative, works eminently... but, it's definitely out of distros' top 20. Only reason for such a situation - I think, is - Crux is time-consuming to install and renew... seeing gcc compile flicker epileptically for an hour, for example, induces some negative thoughts. Oh, well, Crux also doesn't have anything preinstalled, you have to sweat to get your satisfaction.
But, let's:

# I wrote ISO with dd to USB and booted with no problem.
And landed as auto-loginned root in console. Not being especial fan of fdisk, I had sda8 previously created - and that was the only new partition. I see no reason for swap (with 8GB of RAM), and I don't use separate /home in traditional way. Now:
mount /dev/sda8 /mnt
setup
 
I picked /sda8 as my root partition, and next came choosing packages.
Mind! Those packages you see here in repo, in /core, /opt, and /xorg - are NOT all in your puny 250-meg ISO. ISO contains minimal selection for you to get system up and running, and kernel compiled.
It's wise to do a walkthrough in repo-folders, and make clear what is what, what those packages do, and what you really need.

# Package selection.
-- CORE. I left out only btrfs-progs, exim, reiserfsprogs, vim, xfsprogs - as unneeded.
-- Take most of XORG. That, if you are not planning to stay with console.
-- Pick from OPT. Now, picks here depend very much on what you plan to install ... well, as in 'optional' :)
Anyway, here are my picks, according to 'I am going to use X with Openbox and some apps':
atk, cairo, cmake, dialog, expat, fakeroot, fontconfig, freetype, gdk-pixbuf, glib, gperf, gtk, harfbuzz, hicolor-icon-theme, intltool, keyutils, lib*, mdadm, mtools, nano, nfs-utils, openbox, pango, python, rp-pppoe.
After selection, some packages got added as dependencies.
-- As already said, most of packages needs to be compiled/installed afterwards. Whole run takes hours. So, be smart and pick maximum of compiled ones here.

# 'OK' and it copies your selections to disk. Done, no errors on last line?
Ok then, let's chroot, fix some confs and compile our virgin kernel. See here for manual. Next comes, very concisely, what I did:

setup-chroot  # script, puts you stright into fresh Crux system.

passwd  # create your admin passwd

nano /etc/fstab  # fix it, add missing parts. something like that:
/dev/sda8   /          ext4      defaults         1   1
devpts      /dev/pts   devpts    gid=5,mode=620   0   0
proc        /proc      proc      defaults         0   0
sysfs       /sys       sysfs     defaults         0   0
tmpfs       /dev/shm   tmpfs     defaults         0   0


nano /etc/rc.conf  # See here for guidelines. Services I put there were only crond and net. Later I added more - like alsa and gpm...

localedef -i en_US -f UTF-8 en_US.UTF-8

useradd -m -s /bin/bash -G audio,lp,video,wheel -U yourusername
passwd yourusername
nano /etc/sudoers
  # enable wheel for sudo.
! Mind! Crux creates ids as 100:101. Which means, when you start to meddle with your other installed Linuxes, you get 'permission denied' shit - as at least Debian, Slackware and even Alpine all go 1000:1000. I fixed that like this:
usermod -u 1000 yourusername
groupmod -g 1000 users
usermod -g 1000 yourusername


Network. See here. I went for dhcp and used example script, and it worked (well, after I got missing driver added and kernel recompiled).
Don't forget to create /etc/udev/rules.d/70-persistent-net.rules
Some silly-looking stuff in there - better copy it from your other Linux.

cd /etc/ports
mv contrib.rsync.inactive contrib.rsync
/etc/prt-get.conf
- uncomment - prtdir /usr/ports/contrib
For other repos you have to create rsync files (and add entries in prt-get.conf), like:
cat >> /etc/ports/xfce.rsync << EOF
host=crux.nu
collection=ports/crux-3.0/xfce/
destination=/usr/ports/xfce
EOF

! Good thing: you can also use your local make-dir (where you collect your sources and create packages) as 'prtdir' - and prt-get can see it and operate with your packages.
! Mind! When you do prt-get sysup afterwards, the bloody shit overwrites your freshly-fixed prt-get.conf. So, make a copy before...
For confing pkg and ports, see here.

# Kernel compiling. I went with provided oldish 3.6. That's because Crux 3.1 seems to be coming soon (fingers crossed) - with newer stuff and so on. Also, as my linux-life has shown me several times: Do not go with newest, it might not work!

In 'make menuconfig', take your time and pick all needed... I compiled twice as I missed my network driver at first run. Whole process of kernel creation:

cd /usr/src/linux-3.6.x
make menuconfig
make all
make modules_install
cp arch/x86/boot/bzImage /boot/vmlinuz
cp System.map /boot


Fix/install your bootloader.
Done. exit. umount. reboot. If multibooting, fix your master-bootloader.

! By the way - quite a lot of this command-line conf can be done on other Linux' desktop, in more relaxed way than nano.
! Just to mention: runlevel 1 = single-user, 2 = multiuser, 3,4,5 = not used.

End of part 1. Part 2 - Beefing it up, Part 3 - Later problems

2013-07-15

Salix Openbox memory usage

Bliss, yes - but there is always margin for improvements.
Nothing of what follows is a showstopper - or matters very much for everyday use... BUT!

Just after writing the post about being euphoric of my new OB, I noticed how bloody lot of memory it took. Almost twice more than my two Debian OBs (230 to 110-130). Unacceptable! Cultivating an anorectic Openbox is THE sport! So I went for it and culled some more processes:

** salix-update-notifier: process tended to hang around even after session change or logouts-ins, piling additional processes up after every 2 hours, and dragging along 'sleeps' (800k a piece).
Currently, I simply added OnlyShowIn=XFCE; into its' .desktop file in /etc/xdg/autostart/ - simply to avoid it in OB. We'll see... but I think I uninstall it in near future - there isn't a lot of updates to worry about, really. They can be checked-installed manually.
** multiple 'sh /.../openbox/autostart' processes: as investigation revealed, they go with every 'sleep' in autostart. Yeah, they only took 5 megs - but still!
I remade my whole autostart without any 'sleep'... and it works totally OK (shows that copying 'authoritive' advice from web might be err...not always useful).
Also, it seems to matter what is order of started apps in autostart ... If anyone is interested, after 1,5 hour of testing in virtual terminals, I ended up with this order:
nitrogen --restore & 
compton --backend glx --vsync opengl-swc --paint-on-overlay --shadow-exclude "! name~=''" --config ~/.compton.conf & 
spacefm -d & 
tint2 -c ~/.config/tint2/.tint2launchers/tint2rcbleft & 
volumeicon & 
# next is show-hide-desktop-icon-in-systray script (from crunchbang forum) 
~/bin/showdtop.sh & 
xxkb & 
conky -c ~/.conky_ob_rc &
* About virtual terminals... There are only three agetty-s defined in Salix (F1-F3), and tty goes to F4. Bloody strange and unconvinient! Open up your /etc/inittab and add other 3, copy/paste and change numbers. Voila!
Also, 'xinit' to start virtual desktop seems to give somewhat bizarre results... What worked OK (from C+A+F2 to C+A+F8), was:
startx /usr/bin/openbox-session -- :1
** Killed wicd off. I use no wireless - so, no need to configure it. 'removed' wicd - and lost net. Did that, in terminal:
netconfig
Options there were picked like that (and of course those are specific for my situation): hostname = whatever, name of the machine
domain = local
DHCP

Reboot (/etc/rc.d/rc/inet1 eth0_start command was not doing a thing (in perceivable way)... and there appeared nothing in inet1.conf file too. Oh, and no connection.) But booting made it - a wired connection without wicd.

Now my Salix-OB uses less, but still approx 40 megs more memory than OB in Debian.
So I decided to switch from default 'huge' (all things compiled in) kernel to 'generic' (nothing in, neccessary will be added with modules). And hoped shorter boot-time and less memory use.

- Downloaded kernel-generic and modules via http://pkgs.org/slackware-14.0/slackware-x86_64/.
- Did installpkg for kernel-generic, and did not for modules - as it appeared with upgradepkg --dry-run that modules were 100% the same.
- Ran /usr/share/mkinitrd/mkinitrd_command_generator.sh, and executed the result, initrd.gz was created.
- For good measure, reinstalled nvidia drivers.
- Updated local Grub, rebooted to my Grub-master and updated that too. Generic kernel was added as last (Salix) entry. Haven't found out yet how to change it to be first (and default) boot kernel. So, probably I will simply make 06_custom file for Salix Grub.
- Rebooted and got kernel panic... ?? ... Checking grub.cfg - initrd was NOT included (and it IS neccessary for kernel-generic). Added a line:
initrd /boot/initrd.gz.
Successful boot!

But, no change in boot time (though, the text flying by is different... which can be considered 'interesting', but not as a desired result) or in desktop memory usage... So, it seems that I did something wrong. Or something.
And the moral is - you do this kernel-thing in different and right way.