Linux Format - UK (2020-03)

(Antfer) #1
12 LXF260 March 2020 http://www.linuxformat.com

ANSWERS


faster. It is also worth bearing in mind that
if RAM does become short and the system
needs to swap out data, it will not
automatically swap it back in once RAM
becomes free. There is no point in the
system doing that until it is needed,
otherwise it would only have to swap
it out again the next time something
demanded more RAM.
4GB is not considered a lot of RAM
nowadays, especially when using a
heavyweight desktop like KDE. It is
certainly sufficient, but your system is
doing its best to make sure that as much
of that RAM as possible is available for use.
As long as your system is not frequently
moving data to and from swap, which will
really slow things down, your system is
working as it should. Use a memory
monitor, either one of the graphical ones
like KSysGuard or the terminal command
free -h to see what is going on.
I would be more worried if swap was not
being used, as it would mean that
unnecessary code was being allowed to
take up RAM instead of using the more
suitable resources available to it – swap is
there to be used.

Q


Early swap usage
I’m using Kubuntu 19.10 and
noticed that swap was used very early
after starting the desktop, even if there’s
still RAM available (4GB RAM, KDE
Plasma desktop). How can I troubleshoot
what’s causing this early use of swap?
isn’t swap supposed to be used only if
RAM is full? Can I do something about it?
Leon Butcher

A


This is not a problem to be solved, it
is the system working as it should.
Memory management in Linux is both
advanced and mature – years have gone
into optimising it. Data is moved from
memory to swap because it is unlikely to
be needed but has to remain available in
memory in some form. For example, code
used when starting up system services
may not need to be accessed once those
services are running, so it can be safely
paged to swap.
Linux will try to use all the memory
available to it. RAM not occupied with code
or data will be used for filesystem caching
to speed up disk usage. So swapping out
unneeded data can make your system

Got a burning question about open source or the kernel?


Whatever your level, email it to [email protected]


Q


No keyboard
I read the magazine and find it
really useful, although my computing
knowledge is limited. About 11 years back
I migrated to Linux. I’ve managed to deal
with all the hiccups except this one. My
wife was fed up with Windows problems
so I fitted a SSD and loaded Mint 17.3 on
her Toshiba Satellite L850D-12P laptop.
On boot up it doesn’t always find the
keyboard and touchpad. A forced power
off and reboot will fix it maybe the first
or second time. I’ve tried changing boot
from fast to normal as I guess it might be
something to do with timing, but no luck
with that.
Dave Fisher

A


The first thing to check is how your
keyboard and touchpad are
connected to the computer – meaning
what type of interface are they using
internally. You may be able to do this using
a program like lshw or lsusb. My suspicion
is that they use the USB bus internally. If
that is the case, go into your laptop’s
firmware configuration (what we used to
call the BIOS in simpler times) and look for
an option called USB Legacy or something
similar. Try toggling this setting, it affects
how USB keyboards and similar devices
are detected at early boot.
Does the keyboard work after you have
booted? You may need to alter your boot
options, in /etc/default/grub to make
Mint the default boot option – don’t forget
to run update-grub after changing any
Grub options. If it works, you may be able
to find an error message relating to it with:
$ sudo journalctl -b
in a terminal. The -b option tells it to show
entries since the last boot, which includes
the early messages from dmesg. This will
show what hardware detection is done by
the kernel. If you do find errors in here, try
pasting them into a search engine. If you
still have no keyboard after booting into
Linux, install openssh-server (if not already
installed) so you can SSH into the laptop
from your own computer, then you can
check the journal even without the use of a
physical keyboard.

While swap usage is usually low, more of it being used is not a bad thing. The only time it should affect
performance is when data is being frequently moved in and out of swap.

Answers


Neil
Bothwick
is debugging
your code as
we speak,
he’s inside
your home...

12 LXF260 March 2020 http://www.linuxformat.com

faster.It isalsoworthbearinginmindthat
if RAMdoesbecomeshortandthesystem
needstoswapoutdata,it willnot
automaticallyswapit backinonceRAM
becomesfree.Thereisnopointinthe
systemdoingthatuntilit isneeded,
otherwiseit wouldonlyhavetoswap
it outagainthenexttimesomething
demandedmoreRAM.
4GBisnotconsidereda lotofRAM
nowadays,especiallywhenusinga
heavyweightdesktoplikeKDE.It is
certainlysufficient,butyoursystemis
doingitsbesttomakesurethatasmuch
ofthatRAMaspossibleisavailableforuse.
Aslongasyoursystemisnotfrequently
movingdatatoandfromswap,whichwill
reallyslowthingsdown,yoursystemis
workingasit should.Usea memory
monitor,eitheroneofthegraphicalones
likeKSysGuardortheterminalcommand
free-htoseewhatisgoingon.
I wouldbemoreworriedif swapwasnot
beingused,asit wouldmeanthat
unnecessarycodewasbeingallowedto
takeupRAMinsteadofusingthemore
suitableresourcesavailabletoit – swapis
theretobeused.

Q


Earlyswapusage
I’musingKubuntu19.10and
noticedthatswapwasusedveryearly
afterstartingthedesktop,evenif there’s
stillRAMavailable(4GBRAM,KDE
Plasmadesktop).HowcanI troubleshoot
what’scausingthisearlyuseofswap?
isn’tswapsupposedtobeusedonlyif
RAMisfull?CanI dosomethingaboutit?
LeonButcher

A


This is not a problem to be solved, it
is the system working as it should.
Memory management in Linux is both
advanced and mature – years have gone
into optimising it. Data is moved from
memorytoswapbecauseit isunlikelyto
beneededbuthastoremainavailablein
memoryinsomeform.Forexample,code
usedwhenstartingupsystemservices
maynotneedtobeaccessedoncethose
servicesarerunning,soit canbesafely
pagedtoswap.
Linuxwilltrytouseallthememory
availabletoit.RAMnotoccupiedwithcode
ordatawillbeusedforfilesystemcaching
tospeedupdiskusage.Soswappingout
unneededdatacanmakeyoursystem

Gota burningquestionaboutopensourceorthekernel?


Whateveryourlevel,emailit [email protected]


Q


No keyboard
I read the magazine and find it
really useful, although my computing
knowledge is limited. About 11 years back
I migrated to Linux. I’ve managed to deal
with all the hiccups except this one. My
wife was fed up with Windows problems
so I fitted a SSD and loaded Mint 17.3 on
her Toshiba Satellite L850D-12P laptop.
On boot up it doesn’t always find the
keyboard and touchpad. A forced power
off and reboot will fix it maybe the first
or second time. I’ve tried changing boot
from fast to normal as I guess it might be
something to do with timing, but no luck
with that.
DaveFisher

A


The first thing to check is how your
keyboard and touchpad are
connected to the computer – meaning
what type of interface are they using
internally. You may be able to do this using
a program like lshw or lsusb. My suspicion
is that they use the USB bus internally. If
that is the case, go into your laptop’s
firmware configuration (what we used to
call the BIOS in simpler times) and look for
an option called USB Legacy or something
similar. Try toggling this setting, it affects
how USB keyboards and similar devices
are detected at early boot.
Does the keyboard work after you have
booted? You may need to alter your boot
options, in /etc/default/grub to make
Mint the default boot option – don’t forget
to run update-grub after changing any
Grub options. If it works, you may be able
to find an error message relating to it with:
$ sudo journalctl -b
in a terminal. The -b option tells it to show
entries since the last boot, which includes
the early messages from dmesg. This will
show what hardware detection is done by
the kernel. If you do find errors in here, try
pasting them into a search engine. If you
still have no keyboard after booting into
Linux, install openssh-server (if not already
installed) so you can SSH into the laptop
from your own computer, then you can
check the journal even without the use of a
physical keyboard.

While swap usage is usually low, more of it being used is not a bad thing. The only time it should affect
performance is when data is being frequently moved in and out of swap.

Answers


Neil
Bothwick
is debugging
your code as
we speak,
he’s inside
your home...
Free download pdf