We think this year's Hacker Manual is the best one yet. Tuck in and enjoy the hack! EDITORIAL. Editor Neil Mohr. Bookazine editor Chris Thornett. Managing art. Take your Linux skills to the next level with 80+ security tricks and hardware hacks. Over 80 hacking tutorials to get your teeth into! Networking. Welcome & Manifesto Welcome! to the super-enhanced Hacker's Manual for Whether you're time again when you need to things to try and help you.
|Language:||English, Spanish, Dutch|
|Distribution:||Free* [*Register to download]|
Get the UK's best-selling. Linux magazine. OUT NOW!. DELIVERED DIRECT TO YOUR DOOR Order online at ruthenpress.info or find us in. to the super-enhanced Hacker's Manual for . from this terminal, such as : weston-image – an image viewer. weston-pdf – a PDF viewer. weston-flower. The hackers manual Fully revised and updated edition. this terminal, such as: weston-image – an image viewer. weston-pdf – a PDF.
The Wayland project is an attempt to bring the graphical desktop infrastructure up to date. It has taken a lot longer than some expected, as is so often the case, but it is definitely getting there and well worth a try.
Try out the replacement windowing system for the ageing X For now, you will need to edit weston. With software still in testing, the friendly graphical editors tend to come later on. This gives a simpler, lighter and faster system with each part of the software stack handling its assigned tasks and Wayland handling the intercommunication. The reference compositor from the Wayland project is called Weston, and you need to install that, too.
You will see a very basic desktop open with nothing but a terminal icon at the top right. Wayland comes with some example programs that you can run from this terminal, such as: Do something useful Demo programs are very nice, but not that useful.
The shell section sets the basics of the desktop, here we are setting the desktop background and the colour and transparency of the panel at the top of the screen. These are the sort of things that your distro sets defaults for with X, and provides a graphical way of changing it. That will happen when Wayland becomes mainstream, but for now you will need to edit the INI file.
The full format is explained in the weston. Gnome on Wayland Wayland and X can co-exist on the same system, so you can install and experiment with Wayland but still go back to your X desktop whenever you want to.
This makes it safe to try Wayland on your main system well, as safe as trying anything new can be but if you want to just give it a spin, you can try it with Gnome from the Fedora 21 live environment as described below.
What about running the current desktop environments with Wayland? Provided the correct session is installed, and the Wayland libraries, you can pick Gnome on Wayland as an option when logging in with GDM.
The easiest way to try this is with Fedora 21 head over to http: You can even run it from the live disc environment, by logging out and back in. Instead, click the Not listed entry, type the username of liveuser then click on the small icon to the left of the Next button, from where you can choose Gnome on Wayland. Going back to the start of creating weston.
The first was desktop-shell, which is the standard Weston desktop there is also tablet- shell for touchscreen devices and we also loaded xwayland. This modules enables X clients to run on a weston desktop, meaning you can run most of your software on Wayland without having to wait for it to be ported. Mir alternative We cannot talk about new display servers and Wayland without mentioning Mir.
The alternative display server under development by Canonical, shares much with Wayland while borrowing some concepts from Android. Other developers, such as Xubuntu, have considered porting to Mir but have not done so yet.
For now, if you want to try the new graphics engine on any distro, Wayland is the way to go. They may even have some extra repositories of their own that are not enabled by default, as they contain software considered unstable or experimental. They generally provide lists of the extra sources, such as: Arch Linux: These can be added to your particular package manager with the command: Otherwise, you always have the option of gaining geek points by compiling from the source.
Linux hacks n area of Linux that has seen a lot of development lately are filesystems. There are two very good reasons for this: In olden times, you partitioned a drive as you saw fit and then put a single filesystem on each partition. The filesystems evolved: While ext4 has many advantages over its antecedents, it still follows the one filesystem per partition rule.
Then volume managers were developed, such as LVM, which made it possible to split up a single large partition into virtual partitions, or logical volumes, giving far more flexibility to systems. We would add, remove and resize such volumes with ease, although we still needed to deal with the filesystems separately.
Adding extra drives which were using RAID added another layer to deal with.
That meant three sets of tools were needed: You could stick one or more disks in a computer, tell ZFS to create a pool from them and then create volumes in that pool. Nothing needed to be formatted, because the volume manager was also the filesystem; you just told it what you wanted and how big you wanted it to be.
If you changed your mind later, you simply added, resized or removed volumes as you needed, without any fuss. The main disadvantage to filesystem is that its licence is incompatible with the GPL, meaning it cannot be incorporated into the kernel: This is not a major drawback as these are available for most distros, but it does make putting your root filesystem on ZFS more difficult than it would otherwise be.
Install the latest filesystems that are evolving at a rapid rate. There is now another filesystem that is in the kernel and offers a similar set of features to ZFS, called btrfs Note: As btrfs is in the mainstream kernel, there are no problems with running it on the root filesystem. You also need to install the btrfs- tools package, which contains the user space tools. To create a btrfs filesystem on a single partition, run: It keeps two copies of each block of data, on separate drives.
With a two-drive array, this is the same as normal RAID 1, but if you add a third drive, you get more storage, whereas classic RAID 1 gives the same space but more redundancy. Now you can create subvolumes, which act as different filesystems and can have different properties, such as quotas or compression.
ZFS and Btrfs both checksum all data they store. This may reduce performance slightly, but gives far greater data security, especially when using RAID.
Linux hacks Experimenting with filesystems We are not suggesting to reformat your primary hard disk to try out experimental filesystems, but there are other options. You could use an external drive, or a second internal one, if you have one available. This enables you to use a large file as a virtual disk, somewhat like virtual machines do: If in doubt, use the -f option for losetup to have it pick the first available device and then -l to see which it has picked.
They are both copy- on-write filesystems [See Filesystems: The Next Generation, on page 94], which means they support snapshots.
A snapshot of a subvolume uses no disk space and is created almost instantly. It starts to use space when you make changes to the original subvolume, until then only one copy of the data is stored. This enables you to rollback to any point where you made a snapshot, either to recover deleted files or to get an older version of something you are working on. Flash friendly SSDs are becoming cheaper and more popular we feel certain that the two are not coincidental , yet many worry about the write lifetime of solid-state devices.
Having said that, SSDs are very different from magnetic discs and put different demands on filesystems. Traditional filesystems have been optimised for the spinning disks they have been used on for years, but we are beginning to see filesystems that are optimised for flash storage. We have just looked at btrfs, and that has options for use on SSDs, some of which are enabled automatically when such a disk is detected.
One of the problems SSDs can suffer is a loss of performance over time as they experience the SSD equivalent of fragmentation as data is deleted and written to the disk.
However, F2FS takes a different approach to cleaning up after itself. The filesystem was added to the kernel less than two years ago but is still not considered stable, so it fits right in with much of the other software here.
There are two steps to enabling F2FS on your computer. If you want to put your root partition on F2FS, you should build it into your kernel, not as a module. Create an f2fs filesystem with sudo mkfs. Linux hacks ontainers are a recent addition to the Linux kernel.
They are an alternative to virtualisation when you want to run more than one Linux system on the same host. Unlike full virtualisation, such as Qemu, VirtualBox and VMware, where the software emulates a complete computer, containers use the facilities of the host OS. This means you can only run Linux in a container, unlike a full virtual machine where you can run anything, but it is also less resource intensive as containers share available resources rather than grabbing their allocation of RAM and disk space as soon as they are started, whether they need it or not.
Containers operate in their own namespace and use the cgroups facility of the Linux kernel to ensure they run separately from the host system. There are a number of ways of using containers, Docker is grabbing a lot of the headlines and has been is covered over on page , but we are going to look at using systemd-nspawn to run a container. This means you need a distro running with Systemd, which is the norm these days, but you would need that for Docker too.
Initiating a container A container works with either a directory or a disk image containing an operating system. You can specify one or the other, but not both. If neither is given, systemd-nspawn uses the current directory.
This means you can connect the hard drive from another computer and run the Linux OS on it, either by mounting its root partition somewhere and calling Filling a container directory We have told you everything but how to get the OS into your container in the first place. You can copy the contents of an existing installation, or use a disk image, or you can start from scratch.
Debian, Fedora and Arch all have commands to install a minimal system into a directory. Pick one of these: With systemd-nspawn, this is all taken care of automatically, and the directories are mounted read- only so that software running in your container cannot affect the host OS. If you need any other directories to be available inside the container, you can specify them on the command line in a number of ways: The second example also illustrates the use of a read-only mount.
You can have multiple --bind calls on the command line. Booting inside a container As with chroot, running systemd-nspawn with no other arguments runs a shell, Bash by default. The option that makes containers really interesting is --boot.
If this is given, an init binary on the root filesystem is run effectively booting the guest OS in the container. You can even call this from a boot script to bring your container up automatically. If you then need to log into a container, use the machinectl command. With no arguments, it lists the running containers, open a terminal session in one with: Linux hacks Create a test environment and learn by doing.
Many projects make their latest code available via GitHub or a similar service, you will need to install git to try the most recent versions.
It may or not work for you, it may introduce instabilities to your system or it may conflict with existing software. On the other hand it may all work well and improve your life tremendously. There is no way of knowing without trying it. Some software may not be in your distro's repositories so you become the tester as well as installer.
All of it comes with the standard open source guarantee: Installing experimental and untried software on your system is not the best of ideas unless you are comfortable with the risk of erasing and reinstalling your distro if things go awry.
There are several other options: You could test on a virtual machine. These are great for testing distros, but not so good for software that expects real graphics and storage hardware. You could use another computer. This is a good idea, provided it is reasonably powerful. You may end up compiling some of this software from source, no fun on an old system. Old hardware won't give a representative experience of software such as Wayland either. The best option is to dual boot your system, which we will discuss in more detail below.
Dual booting Using dual boot is the safest yet most realistic of creating a test environment. Installing another distro alongside your standard environment means you can compare performance on an identical hardware. Most distro installers have an option to resize an existing distro to install alongside it. If you have a separate home partition, it's easy to share it between the two distros, so you can get on with whatever you need to do in either environment. Which distro should you use?
You could use the same distro as your main system - it's the one you know best and it makes comparisons more relevant. However, your distro may not have repositories with the new software so you may have to build more from source. If you are going to use a different distro,Arch Linux is a good choice. It has packages for just about everything and, very importantly when working on the bleeding edge, the Arch Linux wiki is an excellent source of documentation.
We mentioned extra repositories. While some of the cutting edge software is in the standard repositories of distros, they tend lean towards stability in their official packages. This means you often need to add an extra repository or two in order to install pre-built packages. In some cases, there may not be a binary package available or you may want the very latest version.
Then you will need to look at downloading the source and compiling it yourself. In some instances that means downloading a tarball, unpacking it and following the instructions in a Readme or Install file.
With some software you will need to download the source from somewhere like GitHub. Downloading with git is straightforward and has the advantage that you can get updates without downloading the whole thing again with a simple git pull. The project will have a git address, like https: You download this with the git command install the git package if the command is not available: Repositories for git and similar do not usually have a configure script, so you generally need to run something like autoreconf first to build it, the Readme should explain the steps needed.
Once you have the source, by whatever means, follow the instructions to compile and install it. You will need the autotools and compiler installed, most distros have a meta- package called something like build-essential that installs everything you need to compile from source.
The first step of the process checks that your system has all the dependencies needed to build the software. If it exits with an error about a library not being found, go into your package manager and install that library, then repeat the process. There is a common gotcha in this process, when you get a complaint about libfoo not being installed when it is.
This is because distros split libraries into two packages, the first containing the actual libraries while a separate package contains the header files for the libraries. You will need to Install the header package and that error will then go away. You can download, unpack and compile software as a normal user but installing it requires root privileges in order to copy files to system directories, so the final setp would be something like: Even if you decide they are not ready for you yet, you are guaranteed to learn a lot in the process, and that is never a bad thing.
After all, why go to all that hassle when your distro already provides one? Many stock distro kernels are optimised for a broad set of hardware.
By compiling your own, you can use optimisations that are very specific for your CPU, giving you a speed boost. By compiling your own, you can enable them. There are loads of useful kernel patches in the wilds of the internet that you can apply to the main source code to add new features.
And just from a curiosity perspective, compiling and installing a new kernel will give you great insight into how Linux works. Therefore we strongly recommend doing this on Linux installations that you can afford to play around with, or inside a virtual machine. The home of kernel development on the internet is at www.
VirtualBox is one example of this, because it has its own kernel module, and it needs the kernel source header files to build that module during installation. So, extract the source code like this and note that all of the commands in this tutorial should be run as root: For a GTK-based alternative try: And there are a lot of options — thousands of them, in fact.
However, these cookies also allow the website to track you as you move around on their website. This might sound pretty harmless, but major websites such as Google arent just confined to a single domain. Google, as you may be aware, controls the largest advertising network on the internet. As you move from website to website, in addition to displaying advertisements, the advertising system will also track the websites you visit.
The advertising system then uses this data to display advertisements that are similar to the sites that youve visited. The most important trait a person can have is the ability to differentiate between what is legal and what is ethical. The car hacks that have received the most attention are neither.
There is no reason to put these cars on the road until sufficient testing is done. Craig Smith falls on the safer side of garnering media attention. From a Reddit AMA , he avoids demonstrating his exploits on real cars at all costs. This, by the way, is the standard way of doing things.
Takeaway This is first and foremost a book about hacking the electronics in cars. The skills required to modify an ECU, snoop the CAN bus, or update your sat nav maps without shelling out hundreds are the same skills required to install OpenWRT on a weird router and install Linux on a hard drive the hard way.