2019-05-01_Linux_Format

(singke) #1

16 LXF249May 2019 1114May 209Gotb4u9o


Answers


a quickreFerence to sysrq


inux is usually stable enough to
survive misbehaving software,
butitis possible for a program to lock
up the whole computer. Before you
reach for the power or reset button
and risk corrupting your filesystems,
there is a better way to get out of it.
You can send commands directly to
the kernel by holding down the Alt
and SysReq (aka PrtScr) keys and
pressing certain letter keys. As the
kernel listens for these directly, they
work even if X is completely locked
and accepting no input.
The keys normally used to get out of
a lockup are R, to reset the keyboard –
this occasionally fixes the problem on
its own. Next press E to send a TERM
signal to all processes, asking them to

shut down cleanly, writing any data to
disk and closing any open files. Next in
line is I, which sends a KILL signal to all
remaining processes, forcing them to
shutdown. Pressing S tells the kernel to
sync, flushing all buffers to disk so that
remaining open files can be closed
cleanly. Then you press U to unmount
all filesystems and remount them read-
only, to avoid further data corruption,
and finally B reboots the system.
So hold Alt+SysReq and press R-E-I-
S-U-B in turn, leaving a couple of
seconds between each. There are
several mnemonics to help remember
this, the most appropriate being Reboot
Even If System Utterly Broken. This is
not something you should need very
often, but it’s worth knowing.

gethelPnow!


We’d love to try and answer any questions
you send to [email protected],
no matter what the level. We’ve all been
stuck before, so don’t be shy. However, we’re
only human (although many suspect Jonni
is a robot), so it’s important that you include
as much information as you can. If
something works on one distro but not
another, then tell us. If you get an error
message, please tell us the exact message
and precisely what you did to invoke it.
If you have, or suspect, a hardware
problem, let us know about the hardware.
Consider installing hardinfo or lshw. These
programs list the hardware on your
machine, so send us their output. If you’re
unwilling, or unable, to install these, run the
following commands in a root terminal and
send us the system.txt file too.
uname -a > system.txt
lspci >> system.txt
lspci -vv >> system.txt

L


A


Unfortunately, the same is not
possible with Peppermint; its
developers have specifically chosen to not
provide an upgrade path, requiring a
reinstall for each new version.
That leaves you with two options: you
can stick with Peppermint 8, which is still
supported, and keep it updated for as
long as you use it, or you can backup and
reinstall instead.
Reinstalling is made easier if you have a
separate partition for /home. Peppermint
does not offer this option by default, but
you can do so by selecting the ‘Something
else’ option on the ‘Installation type’
screen when installing. This will display
your existing partitions.
Leave swap as is, resize / to around
20GB – that’s more than enough for a
lightweight distro like Peppermint – and
set up the remaining space as an ext
partition to be mounted at /home.
A distro installed like this will
operate exactly the same as the ‘all on
one partition’ approach, but it makes
upgrades, or switching to a different
distros, easier as your personal files will
not be touched.
Before you start the installer you
need to copy everything important to an
external drive or USB stick. You will need
one at least as large as the data in your
/home directory.
If the external drive is formatted with a
Linux filesystem, such as ext4, you can use
rsync to backup the /home directory:
$ sudo rsync -a /home /media/external/
where /media/external is the mount point
of your external drive. This gives a simple
mirror that you can restore afterwards
with rsync:


$ sudo rsync /media/external/home/
/home/
Note the slightly different syntax


  • we’re not just reversing source and
    destination. Note also that we use sudo ,
    as we are backing up and restoring the
    whole of /home rather than an individual
    user’s home directory.
    If the external drive is formatted with
    a Windows filesystem, you cannot simply
    mirror the files as this will remove file
    ownerships and permissions – so we need
    to use a backup program. You could use
    one of the graphical backup programs
    such as DejaDup if you want something
    more convenient, or you can use plain old
    tar, like this:
    $ sudo tar -c /home | split --bytes=1G
    /media/external/backup.tar.aa
    The -c option tells tar to create an
    archive: use -cv if you want to watch a list
    of the files being added scroll past. A tar
    archive will be the size of all the files in
    /home, which may well exceed the size


limit for a single file, especially if you are
using a FAT filesystem on the external
drive. So we pass the output through the
split command to break it up into 1GB
chunks. You can unpack the backup once
you have installed the new OS like this:
$ cat /media/external/backup.tar.* | sudo
tar -x -C /
Here we join the chunks together with
cat and pipe it to tar, which uses the -x
option to extract the archive, while the
-C / argument tells it to unpack to the root
of the filesystem.
This will cover all of your personal files
and settings. If you want to backup global
settings and data, such as files in /etc or
databases in /var/lib (you’ll know if you
need these), just back them up to your
/home directory before performing the
above backup and restore commands,
then restore them after booting into the
new system.

Peppermint is not designed to be upgraded
in-place, but the lack of a separate partition
for /home makes the task more difficult.
Free download pdf