Pages

Showing posts with label Firefox. Show all posts
Showing posts with label Firefox. Show all posts

2013-10-12

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/IcedTeaPlugin.so (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:
load_video
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:
#!/bin/sh
# Refresh font cache
Terminal --execute bash -c 'echo "fc-cache -fv";sudo fc-cache -fv;bash'
quit


## 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
fi


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

2013-04-05

Debian, rant, and Firefox

As already mentioned, I started to play with Debian Sid. And Debian means quite 'free soft only', or to put it in more practical way - 'more troubles to install elementary things'. Add here silly-but-oh-so-superior eloquency of debitards about 'Debian way' (this 'way' mostly seems to mean 'relentless and insulting arrogance' toward all those not members of Debian' Forum Pro Club). Despite not have been at a receiving end myself - being anti-social and not-forum-person as I am - I find general Debian forums (and Debian way) to be mightily off-putting. Not to mention, time-wasting when trying to find a bit of info in this sea of agressive trolling.
And additionally to previous, I had constant bugs with the love-child of Debian community - Iceweasel. It's quite mind-boggling really, how it's possible to make slight fork of Firefox so buggy... experimental repo or not... well, with great care and effort, I presume.

After a week of Iceweasel bugs coming, being, going, coming... and so on, and seriously fearing the possibility of stroke or at least nervous skin-rash, I decided to install the evil - Firefox.
As is my bad habit, I read, found very different howtos and felt kinda 'now-what?'.
Then I downloaded a binary and installed. That went OK, only - Firefox didn't work, not at all... Then I found out that file you download from public Mozilla is always 32bit - and is not working on 64bit Debian. Not without additional hassle, at least. There seem to be multi-arch transitional packages to install and force Firefox, but I didn't bother.

I downloaded 64bit version from not-so-public directory: http://releases.mozilla.org/pub/mozilla.org/firefox/releases/latest/linux-x86_64/.
And proceeded like that:
sudo apt-get remove iceweasel
then deleted ~/.mozilla folder and copied firefox-19.0.2.tar.bz2 to /opt.
sudo tar -xjvf firefox-19.0.2.tar.bz2
cd /usr/local/bin
sudo ln -s /opt/firefox/firefox
cd ~/.local/share/applications
# make new firefox.desktop file like following:
[Desktop Entry]
Name=Firefox
GenericName=Web Browser
Exec=/usr/local/bin/firefox %u
StartupNotify=true
Terminal=false
Type=Application
Icon=/home/yourname/firefox/chrome/icons/default/default32.png
Categories=Network;WebBrowser;
MimeType=text/html;text/xml;application/xhtml+xml;application/xml;application/vnd.mozilla.xul+xml;application/rss+xml;application/rdf+xml;image/gif;image/jpeg;image/png;x-scheme-handler/http;x-scheme-handler/https;
# That's end of file. Save.

cd ~/.local/share/applications/
#add into file mimeapps.list
[Added Associations]
application/xhtml+xml=firefox.desktop;
text/html=firefox.desktop;
# and in terminal for proper icons...
sudo ln -s /opt/firefox/icons/mozicon128.png /usr/share/icons/hicolor/128x128/apps/firefox.png & sudo ln -s /opt/firefox/icons/mozicon128.png /usr/share/pixmaps/firefox.png

Go to 'Preferred applications', mark Firefox as your 'Web browser'.
Check into .local/share/applications/mimeinfo.cache - and if needed, replace all instances of 'iceweasel' with 'firefox'.
Fix any launcher that still has 'Iceweasel' in it (tint2, for example). Done... Probably.
Easy, no? Yes, it is - childs' play compared to some other things.

NB! For updates: Either you have to change permissions of Firefox install-directory OR start Firefox for updating via sudo. Otherways it can't write ... Not that I mind especially - Mozillas' continuous updates are one of the most irritating things on planet Earth. So, not updating can be a relief really.
Still - we should update, at least for security reasons.