Archive for Linux Community

Grub boot kernel only once vs Lilo -R

People which started to use Linux in the `90 probably miss nowdays Lilo. Grub is now installed by default on every linux distro. However Grub is not that bad at all its only hard to get use to it in the begining.

I came accross one problem, trying to test vanila kernel which i compiled, however i did not know how to make grub to boot my kernel only once for a test (good old lilo -R new-kernel) command.

I started to search on google and i have found this:

booting-only-once
This seems to be quite old method because you would run into this problem:

root@boss [~]# grub-set-default 1
-bash: grub-set-default: command not found
root@boss [~]#
As you can see there is NO such command grub-set-default. I tought, okey maybe there are some additional rpm packages for grub which will replace this missing command, but i was not able to find ANYTHING!

After looking for grub`s tutorial i have came accross one nice command:

savedefault –default=X –once

This is the right command which replaces lilo -R or grub-set-default!

Now here is working example:

my /etc/grub.conf:

# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE: You have a /boot partition. This means that
# all kernel and initrd paths are relative to /boot/, eg.
# root (hd0,0)
# kernel /vmlinuz-version ro root=/dev/VolGroup00/LogVol00
# initrd /initrd-version.img
#boot=/dev/hdc
default=0
timeout=10
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu

title Fedora Core (VZ)
root (hd0,0)
kernel /vmlinuz-2.6.18-8.1.4.el5.028stab035.1 ro root=/dev/VolGroup00/LogVol00 rhgb
initrd /initrd-2.6.18-8.1.4.el5.028stab035.1.img

title Fedora Core (2.6.17-1.2187_FC5)
root (hd0,0)
kernel /vmlinuz-2.6.17-1.2187_FC5 ro root=/dev/VolGroup00/LogVol00 rhgb
initrd /initrd-2.6.17-1.2187_FC5.img

As you can see by my config file, the "VZ" kernel is default and it will be booted first.

The second kernel is "2.6.17-1.2187_FC5" - which is old FC5 kernel.

For test i want to boot "2.6.17-1.2187_FC5" old kernel first instead default "VZ" kernel.

To do that at shell prompt type:

grub

GNU GRUB version 0.97 (640K lower / 3072K upper memory)

[ Minimal BASH-like line editing is supported. For the first word, TAB
lists possible command completions. Anywhere else TAB lists the possible
completions of a device/filename.]
grub>

Now type this: savedefault –default=1 –once

grub> savedefault –default=1 –once

Next line type: reboot

grub> reboot

and you are back into shell prompt.

Now reboot your system and thats it !

Simple! I did not come accross any tutorial which will explain in plain english how to boot kernel once !

Comments

Preferred method when it comes to storing data in database

When it comes to storing data, what is the preferred method?

XML, JDBC (with or without ODBC) and an external SQL database, or one of these "in-the-application" databases (the ones I've seen are SQL)?
what kind of data? for a simple application you can use hsql or xml Any kind of data, I guess….I'm not thinking specifics here. Just in generalities.
ThomasO: flat files are still bomb Flat files…refresh my memory…files that contain text?

Not necessarily text, no Ah, ok. A quick wikipedia search turned up all the answers about them.
Rather primitive things, but effective for some information.
< \n> how do i clear a char[] array?

\n: you either iterate over it.. or scrap it and create a new one for (int i = 0; i < char.length; i ++) { char[i] = null; }
not really, no
Why wouldn't that work?
a char is not a reference
so that wouldn't compile
and it would be slow

< \n> i cant just say mychararray = null; ?
\n: that would not clear it as such.. just lose it :)
< \n> i want to reuse it for a loop
< \n> just a temp var Err, not char. But char would be the name of your array. Then it might work.
well a char[] array implies it's a char[] :) MXV: Wouldn't that work?

If, in my code, you replaced char[] with name[] where name was the name of the array in question?
Thomas0: null is not a valid value for a char
for(int i = 0, j = c.length; i < j; i++) c[i] = 0; would be the correct way to iterate over and empty a char[] array
….ok…explain the j thing… That seems like a waste of code.

it just avoids fetching c.length for each iteration
(which is not optimized away by the compiler and thus slow)
c = new char[c.length]; has the same result with gc overhead.. faster if the array is large and you do that fairly infrequently Doesn't the HotSpot compiler optimize it?

I was under the impression that HotSpot optimizes any frequently used code.
null rather than 0 and a variable named char were the only things preventing your code from compiling The char variable was just stupidity. And char is something I use infrequently.
So the first thing that came to mind was null, but if I got an error in a compiler, I would have changed that to 0 first thing.

Anyway…has anyone here used SmallSQL?
anyway, that can't be optimized away by hotspot.. as c might change to something else while the loop is running I never thought of that, but it makes sense.
hotspot optimization is rather sloppy.. so it won't bother to check the scope and resolve stuff too deep.

The first time I ran hotspot, I was like "hopy crap" after it turned a certain procedure into taking 5 minutes for large files to <2 minutes.
(and by large files, I mean reading in and analyzing multiple files in the GB ranges)
it inlines stuff and does some local copying, but nothing too fancy.

I've never bothered to analyze how it worked…it's not open source, is it?
just swapping out the interpreter for native code gives quite a boost in itself
the source is available with the scsl license Never messed with native code…you do mean JNI, right?
no.. hotspot generates native opcodes that execute directly on the cpu

Like good old jit As opposed to bytecode?
right If it's so much faster, why doesn't Java use it anymore?
methods are executed as interpreted bytecode until they get hotspotted
hotspot is quite like jit for frequently used methods

So java essentially does use it Wouldn't it be faster if all of the bytecode was transformed to native code prior to running? And then the native "executable" file would only function on one machine.
no But then you could take your source code and compile it or put your byte code on any machine.
then you would lose the dynamic optimization that hotspot does in addition to the compilation

Hotspot can optimize things a static compiler/optimizer can't do I was thinking like HotSpot but for the entire program…optimizing everything from the bytecode for a particular machine to make a unique executable.
which is why hotspotted java is faster than statically compiled C/C++.. or jitted java
unique executable is no good as it can execute in a number of different ways.. which calls for differnet things to be optimized

You would be inlining things that may never be never used I see…although this has been interesting, it's 100F+ here and a little too hot to be running my PC for long periods of time (stupid broken AC). So I'm off for a while.

Thanks MVC for a nice little convo to get me thinking about things.
as for storing data.. don't underestimate data records in a flat file with a separate index :) Err…MXV.
Yeah, that is helpful…
Thanks again.

Comments

Install mod_perl on apache 2.2 with Linux Fedora

how can I install mod_perl on apache 2.2 with fedora?

fedora claims that mod_perl is on the system in "add/remove software" but i cant find it

rpm -qa|grep perl
thx
mod_perl
mod_perl is listed…but …im not sure how to put it in httpd.conf
cuz i cant find any relevant files outside of documentation

rpm -q –filesbypkg mod_perl
thx
THAT one says "package mod_perl is not installed"
mod_perl requires apache files to compile
god damn it
huh ?

you said the other one showed it ?
it did
ok
woops lol wrong vnc
hahahahaha
use shell not vnc!

Comments

Using Yum at Linux

I have a question about using yum
Well.. a particular package is at 2.6 in the Yum repositories but it crashes all the time and this is a known issue.

In G entoo you can install older versions by specifiying the version number.
Can you install previous versions of an app using Yum?
Any ideas Jy?

I don't think you can with yum
using older versions is stupid

and yes you can do it using rpms

not advisable though

And im with JY on this one too
PsychOmeg: I use FC5 as my desktop at work. Evolution 2.6 crashes left and right… everytime I open it. It's apparently a known issue with 2.6.
I've read 2.2 is quite stable.
well what does the developers site say ?

Wouldnt it be better to get a fixed version and compile a rpm ?
Haven't gotten that far yet.
thats what id do
I have the source for 2.2. But its now dependency hell time. :)
yes

Get something newer
check with the developers
Yeah I could.. Smetimes takes so long for a reply.
no i meant check for newer source

well and then debug info
should be in the tar ball
Oh they have 2.4 and 2.6 and 2.7 (unstable) source
then get a spec file modify it to suit needs and compile rpm

done
That's just it. Not sure what makes it crash. Could be the way the RPM was built. Could be the version itself.
strace ftw

debug ftw

error codes ftw

;-p

logs ftw!
Man.. a lot of damn work just to connect to an Exchange server! :)

Comments

Crontab problems

does /etc/cron.daily run at midnight?

depends what cron is set to

/etc/crontab
02 4 * * * root run-parts /etc/cron.daily
i suck at cron rofl
let me read

thats 4am ?
0 4 * * * root run-parts /etc/cron.daily
0 0 * * * root run-parts /etc/cron.daily
that be right?

* * * * * command to be executed
- - - - -
| | | | |
| | | | —– day of week (0 - 6) (Sunday=0)
| | | ——- month (1 - 12)
| | ——— day of month (1 - 31)
| ———– hour (0 - 23)
————- min (0 - 59)

ok :)
Thank you
Thanks for the help man

Comments

Alternate commands for adding users except adduser & useradd

anyone know any alternate commands for adding users, except 'adduser' and 'useradd' ?

useradd is the command
and it's in /usr/sbin
adduser is a symlink to it
oh

hm
I get "bash: adduser: command not found."
any idea why?
su -
I think its FC5

cause you didn't su right
then try it
the little - is important
or use full path

/usr/sbin/useradd blah
"su: user useradd does not exist"
jebus
hah

su -
su - && useradd blah
oh, cool.. thanks

Comments

Cloneable interfaces at Linux

hmm, i dont quite understand what the Cloneable interface is for?

i have an abstract class

with a bunch of sub classes
It's there to indicate that your class is in fact clonable
and some of them are cloneable

so, when trying a clone and wanting to verify that the object is infact cloneable
you get an exception
CloneNotSupportedException, right?
well, no because i know it throws that

i do if (obj instanceof Cloneable)

which determines if the class actually implements the interface
Don't explain java code to me :)
heh sorry

Tell me what the problem is
but what then? i cant seem to call the public clone method without casting it to the specific types implementing cloneable

and a public clone method

i thought the Cloneable interface would actually implement this method so I could use it
Then either implement it on the base class or have something on the base class that delegates the call
easy peasy :)
er.. what?

alright thanks
Interfaces don't implement methods
they declare their existence
yea

what i meant, sorry
or a requirement really
heh

Action: jjava giggles hysterically
your sub-classes that are Clonable, all have to implement the clone()-method
or have one provided for them through a common base class
yea

but then if implementing clone in the base class, i wouldn't know which of the sub classes that actually have a valid clone method

so i'd have to catch the exception of calling clone() ?
er.. they all do in that case
catching the exception is unrelated
CNSE is a check exception and is therefor mandatory to catch and/or re-throw
er.. declare throws
ah alright

thanks

Comments

« Previous entries ·