Firefox, Grub2, Bash aliases etc

I have been busy - and it seems to continue like that. So, no much time to play around. Here come bits and pieces of things I had to do or didn't but still did. Let's start with Firefoxes:

## The problem: Firefox consumes up to 100% of CPU, and never falls below 20%. To make it even more exciting - this doesn't happen in every session... but when it does, then nothing helps. I started to have this behaviour couple a weeks ago in two different distros - Debian Wheezy and Slackware 14. Common was that they both had Firefox 17.09esr AND had some similar updates to Xorg.
Problem seems to be solved by installing other Firefox version. I went for 24.0. For further thrill - the one I downloaded from Mozillas' server, absolutely refused to start... but one I got from here, was OK and works without turning CPUs fan to jet engine.
How to manually install Firefox - look here.
Edit | If after install there isn't any plugins anymore - like IcedTea - then the easiest way is: create a folder .mozilla/plugins, cd to there and do
ln -s /usr/lib64/ (in Slack, or from usr/lib/ in Debian) |

## I finally had enough of Grub2s' auto-generated menuentries. First, there are too many of them (menu-submenu thing, and some kernels doesn't have to be shown at all) and second, labels that Grub creates are not especially informative - or not at all - my Puppy Slacko had a label 'Unknown Linux'.
So I made files 06_debian, 07_slack, 08_test and 41_win (from /etc/grub.d/40_custom). First has my two debians, second has Salix and Slackware, third is for temporary Linuxes and fourth for you-guess-what. Took entries from each distros /boot/grub/grub.cfg (or from /etc/lilo.conf), cleaned them up (everything after label, hint-crap in if-fi part (do NOT delete search-part there)) and inserted them to their new homes.
Also, fixed finally the console resolution problem (all resos in non-master-grub distros' consoles stay at 640x480 - despite that my master-grubs' conf is fixed AND I fixed it in every bloody other grub).
First, the master-grubs reso-fix (in /etc/default/grub) works ONLY for this same grub, AND - when Grub2 os-probes other distros and creates menuentries - it does NOT include reso part there.
So, it's fixable in two ways:
- either add two lines after label part ends and business-part starts:
set gfxpayload=keep

- or add kernel parameter: vga=791 (to end of line starting with 'linux...' Mind! This number has to be picked according to resolution your monitor is capable in console.)
Frankly - i didn't experiment with all possible combinations - I used first option for Grub-distros, and the second one for Lilo-distros.
One more thing - if there appears unwanted (penguin) logo at the beginning of boot, then adding kernel parameter logo.nologo fixes it.
See also previous Grub posts: 1 and 2.

## Some desecrating of Slackware:
- Sudo. As there is no group for that, you can't add user to it, and sudo doesn't work. Now, you can add yourself to wheel group
usermod -G wheel username
and then you can enable sudoing through wheel.
Do 'visudo' ... and yeah, it bloody opens in vi. I, for example, know nothing of this adorable 'very powerful' editor. So: I added following to end of my .bashrc
export EDITOR=nano
, saved, opened new terminal, visudo - and now it opens in nano.
Find the following line
# %wheel ALL=(ALL) ALL
, uncomment it, save. And sudo should work now.
In Slack there might be slight problem with system-binaries still not working. It's because user lacks path to them - not because sudo is not working. Open up your .bashrc and add PATH to /sbin:/usr/sbin:usr/local/sbin - that should solve the problem.
- Colors. To make Slacks' boot and shutdown texts fancier-looking, it's easiest to shamelessly copy relevant parts from Salix (thanks, Salix-folks).
First, one has to copy color-definitions file /etc/shell-colors, and then comes boring compare-search-replace routine in files: /etc/rc.d/rc.S, rc.K, rc.M, rc.4, rc.sysvinit, rc.6
Not sure it's worth of it... well, yeah, I think it was for me.
- rc.M and refreshes. There are several things Slackware refreshes at every boot. Like font cache, icons cache, libraries list (ldconfig), mime cache. It does those tasks in background (command &), so there is probably not much difference (in boot time etc) if they are there or not. Still, it's a bit pointless to refresh those things every time.
So I decided that it's good time to start messing with bash scripts and to make some tiny simpleminded launchers I can start from openbox menu. (And then out-comment relevant parts in rc.M)
As I also know nothing of bash, it took unholy amount of googling and trying. First thing, I couldn't get scripts running with su (despite various suggested tricks in web). So I did it through sudo (see above, that's why I made it to work). I wanted my scriptlets to open new terminal, do it's thing, and leave terminal open - so I could see what occurred. And one successful example is here:
# Refresh font cache
Terminal --execute bash -c 'echo "fc-cache -fv";sudo fc-cache -fv;bash'

## I shit around with three different package managements. Quite frequently I mix up if there are --, or -, or there isn't any -. So, kinda lazy solution for this is to use similar aliases in all distros.
Orderly way to do this is to create separate .bash_aliases file and define all your stuff there (simple text file, only aliases there, no #! or something needed):
alias up='sudo apt-get update' - is one definition, and that's for Debian, 'slapt-get -u' goes for Salix and 'slackpkg update' for Slackware.
alias upg='sudo apt-get dist-upgrade' is for Sid, 'slapt-get --upgrade' for Salix and 'slackpkg upgrade-all' for Slackware.
And so on. To keep in mind - aliases have to be unique (in one particular distro), can't have different commands with the same name (meaning, it's bad idea to create alias 'nano' for something - as there is already app exec 'nano').
Also, in this case, .bashrc should have the following somewhere:
if [ -f ~/.bash_aliases ]; then
    . ~/.bash_aliases

And the future posting will be probably quite infrequent. Depends how 'busy' my busy is...

No comments: