Skip to content

Commit 707e193

Browse files
committed
Always run "dmesg" with sudo
The dmesg command allows you to review the messages that are stored in the ring buffer. Some Linux distributions have strict requirements for dmesg, and you need to use sudo to use dmesg.
1 parent 11e40dc commit 707e193

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

lkmpg.tex

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,7 @@ \subsection{Passing Command Line Arguments to a Module}
412412
I would recommend playing around with this code:
413413
\begin{verbatim}
414414
$ sudo insmod hello-5.ko mystring="bebop" myintarray=-1
415-
$ dmesg -t | tail -7
415+
$ sudo dmesg -t | tail -7
416416
myshort is a short integer: 1
417417
myint is an integer: 420
418418
mylong is a long integer: 9999
@@ -422,11 +422,11 @@ \subsection{Passing Command Line Arguments to a Module}
422422
got 1 arguments for myintarray.
423423
424424
$ sudo rmmod hello-5
425-
$ dmesg -t | tail -1
425+
$ sudo dmesg -t | tail -1
426426
Goodbye, world 5
427427
428428
$ sudo insmod hello-5.ko mystring="supercalifragilisticexpialidocious" myintarray=-1,-1
429-
$ dmesg -t | tail -7
429+
$ sudo dmesg -t | tail -7
430430
myshort is a short integer: 1
431431
myint is an integer: 420
432432
mylong is a long integer: 9999
@@ -436,7 +436,7 @@ \subsection{Passing Command Line Arguments to a Module}
436436
got 2 arguments for myintarray.
437437
438438
$ sudo rmmod hello-5
439-
$ dmesg -t | tail -1
439+
$ sudo dmesg -t | tail -1
440440
Goodbye, world 5
441441
442442
$ sudo insmod hello-5.ko mylong=hello
@@ -1684,12 +1684,11 @@ \subsection{Hash functions}
16841684

16851685
\samplec{examples/cryptosha256.c}
16861686

1687-
Make and install the module:
1687+
Install the module:
16881688

16891689
\begin{codebash}
1690-
make
16911690
sudo insmod cryptosha256.ko
1692-
dmesg
1691+
sudo dmesg
16931692
\end{codebash}
16941693

16951694
And you should see that the hash was calculated for the test string.

0 commit comments

Comments
 (0)