Linux Format - UK (2019-12)

(Antfer) #1
http://www.techradar.com/pro/linux December 2019 LXF257 13

ANSWERS


However, there is a much simpler
solution. It sounds like you have bought
this Pi and are looking for something to use
it for; this is not it. The simple solution is to
buy a USB OTG (On The Go) cable which
will enable you to connect a normal SD
card reader to your phone’s microUSB
port. It is also possible to get an OTG
card reader, avoiding the separate reader
and cable.
You may need to enable OTG in the
phone’s settings (matthew did let us know
his phone doesn’t support OTG. DOH!–ED)
in order to be able to mount the SD card,
then you can access its contents through
your preferred file manager and upload
them to your cloud service using the
phone’s wireless connection. If you really
want to involve the Pi in this process, leave
it at home running Nextcloud. You will have
your own private cloud service and all your
photos will be waiting for you at home
when you return.

Q


Slax on USB
I have a problem with Slax on a
USB drive. When this month’s Linux
Format arrived I decided to try running
Slax from a USB drive because I had
never tried to run an OS from USB. I put
the ISO onto a 1GB drive using:
$ sudo dd if=slax-32bit-9.9.1.iso of=/dev/
sdb
The code was written to the USB
drive. Then I altered the computer boot
sequence to read USB first. After putting
the USB into the computer, I started the
computer and I could see it reading the
USB first. However, Slax did not start.
To test the validity of the code, I
repeated the process with a DVD disk.
That did start Slax but took a long time
to do so. Next I reformatted the USB
drive and started again. But Slax would
not start the computer. Where am I
going wrong, please?
Bryan Mitchell

A


You cannot simply dump an ISO
filesystem for an optical drive onto a
USB stick, or hard drive, and boot from it.
The two types of media use different boot
processes, the main difference being that
on a USB stick or hard drive the system
expects to find a partition table, whereas
optical discs have none.
At this point readers will be shouting
“I can boot Ubuntu/Mint/whatever ISO
images from a USB stick”, and they are
correct, as there is a way to make an ISO
image bootable from a USB stick, using
what is known as a hybrid format ISO
image. The Slax ISO has not been
processed in this way, but it is easy enough
to do yourself. This applies to any bootable

ISO, not just Slax, so the first step is to
check whether the ISO is hybrid, using
fdisk. Open a terminal and run:
$ sudo fdisk -l /path/to/slax.iso
If all it shows is something like
Disk slax-64bit-9.11.0.iso: 264.86 MiB,
277708800 bytes, 542400 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes /
512 bytes
I/O size (minimum/optimal): 512 bytes /
512 bytes
then there is no partition table and the
image is not (yet) USB-bootable. If this is
followed by partition information, you can
dd the image to a USB stick. To add that
partition information, install the syslinux
package from your distro’s package
manager, then you can go back to your
terminal and run:
$ isohybrid /path/to/slax.iso
This modifies the ISO image by writing
partition information to an otherwise
unused area at the start of the image,
which means you have to copy the ISO file
from the DVD to your hard disk
beforehand. Running fdisk again should
now reveal some extra information – the
partition table – and you can now dd it to
your USB stick and boot from it.

Q


Binary chop
I need to feed a program the
ending part of a binary data file whose
first x bytes have to be ignored. Basically
I have to strip a binary data file of its
initial part and read it starting from an
offset value.
I have a hunch that a program like tail
or head should be used, but being a
newbie I can’t understand how to do this.
Could you please provide a command

Some distros have ISO images that
will boot fine from a USB stick. Others,
like Slax, need a little massaging first.

GET HELP NOW!


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

line telling me how to feed (using piping,
I suppose) the file BinaryData.bin
starting from an offset value OFFSET, as
if it was the first byte, to the program
Program?
Grabby

A


You can do this with tail (you would
use head to output the first part of
the file). You can also do it with dd and
split. There are probably others too, but we
will just look at how to use these three.
Using tail:
$ tail --bytes=+X BinaryData.bin | <program>
Tail (and head) normally work in a line-
based mode as they are usually used on

1112Decmbr rb2c09Gob0Gtauni December 2019 LXF257 13


ANSWERS


However, there is a much simpler
solution. It sounds like you have bought
this Pi and are looking for something to use
it for; this is not it. The simple solution is to
buy a USB OTG (On The Go) cable which
will enable you to connect a normal SD
card reader to your phone’s microUSB
port. It is also possible to get an OTG
card reader, avoiding the separate reader
and cable.
You may need to enable OTG in the
phone’s settings (matthew did let us know
his phone doesn’t support OTG. DOH!–ED)
in order to be able to mount the SD card,
then you can access its contents through
your preferred file manager and upload
them to your cloud service using the
phone’s wireless connection. If you really
want to involve the Pi in this process, leave
it at home running Nextcloud. You will have
your own private cloud service and all your
photos will be waiting for you at home
whenyoureturn.


Q


Slax on USB
I have a problem with Slax on a
USB drive. When this month’s Linux
Format arrived I decided to try running
Slax from a USB drive because I had
never tried to run an OS from USB. I put
the ISO onto a 1GB drive using:
$ sudo dd if=slax-32bit-9.9.1.iso of=/dev/
sdb
The code was written to the USB
drive. Then I altered the computer boot
sequence to read USB first. After putting
the USB into the computer, I started the
computer and I could see it reading the
USB first. However, Slax did not start.
To test the validity of the code, I
repeated the process with a DVD disk.
That did start Slax but took a long time
to do so. Next I reformatted the USB
drive and started again. But Slax would
not start the computer. Where am I
going wrong, please?
BryanMitchell


A


You cannot simply dump an ISO
filesystem for an optical drive onto a
USB stick, or hard drive, and boot from it.
The two types of media use different boot
processes, the main difference being that
on a USB stick or hard drive the system
expects to find a partition table, whereas
optical discs have none.
At this point readers will be shouting
“I can boot Ubuntu/Mint/whatever ISO
images from a USB stick”, and they are
correct, as there is a way to make an ISO
image bootable from a USB stick, using
what is known as a hybrid format ISO
image. The Slax ISO has not been
processed in this way, but it is easy enough
to do yourself. This applies to any bootable


ISO, not just Slax, so the first step is to
check whether the ISO is hybrid, using
fdisk. Open a terminal and run:
$ sudo fdisk -l /path/to/slax.iso
If all it shows is something like
Disk slax-64bit-9.11.0.iso: 264.86 MiB,
277708800 bytes, 542400 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes /
512 bytes
I/O size (minimum/optimal): 512 bytes /
512 bytes
then there is no partition table and the
image is not (yet) USB-bootable. If this is
followed by partition information, you can
dd the image to a USB stick. To add that
partition information, install the syslinux
package from your distro’s package
manager, then you can go back to your
terminal and run:
$ isohybrid /path/to/slax.iso
This modifies the ISO image by writing
partition information to an otherwise
unused area at the start of the image,
which means you have to copy the ISO file
from the DVD to your hard disk
beforehand. Running fdisk again should
now reveal some extra information – the
partition table – and you can now dd it to
yourUSBstickandbootfromit.

Q


Binary chop
I need to feed a program the
ending part of a binary data file whose
first x bytes have to be ignored. Basically
I have to strip a binary data file of its
initial part and read it starting from an
offset value.
I have a hunch that a program like tail
or head should be used, but being a
newbie I can’t understand how to do this.
Could you please provide a command

Some distros have ISO images that
will boot fine from a USB stick. Others,
like Slax, need a little massaging first.

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

line telling me how to feed (using piping,
I suppose) the file BinaryData.bin
starting from an offset value OFFSET, as
if it was the first byte, to the program
Program?
Grabby

A


You can do this with tail (you would
use head to output the first part of
the file). You can also do it with dd and
split. There are probably others too, but we
will just look at how to use these three.
Using tail:
$ tail --bytes=+X BinaryData.bin | <program>
Tail (and head) normally work in a line-
based mode as they are usually used on
Free download pdf