Instructions for remastering Linux Mint 17.1 and personalizing the live user session
To keep this guide simple, just copy and paste each line one at a time, for an explanation of what each step is for, check out the original post where | found the squashfs instructions: Linux Mint Forums
Note: a few of the commands are so long that they go to multiple lines depending on your screen size and word wrap, which may cause some confusion and errors if not copied completely. So I’ve alternated between 2 colors for
each command. For example, if a command is purple and take up 3 lines, copy the whole thing to your terminal
Shortcuts to different sections of the guide
- 1. Acquire the necessary software
- 2A. Create project from scratch
- 2B. Resume/continue your project
- 2C. Exit chroot environment
- 2D. Build .iso
- 3. Modify the system
- 4. Personalizing the desktop/theme
- Acquire the necessary software
Ia. Install packages from the repository
Open a terminal and type:
sudo apt-get install squashfs-tools genisoimage resolvconf
1b. Download Linux Mint
( I use Mint 17 Mate, 32bit for compatibility with older pc’s, but you can use any version)
link: Linux Mint Download page
move the downloaded .iso file from your /Downloads folder to your /home/user folder
- Setting up, resuming, and building .iso
2A. Create project from scratch
Open a terminal and type/copy:mkdir ~/livecdtmp
cd ~/livecdtmp
mkdir extract-cd mnt
sudo mount -o loop ~/linuxmint-17-mate-dvd-32bit.iso mnt
sudo rsync --exclude=/casper/filesystem.squashfs -a mnt/ extract-cd
sudo unsquashfs mnt/casper/filesystem.squashfs
sudo mv squashfs-root edit
sudo cp /etc/resolv.cont edit/etc/
sudo cp ~/.config/user-dirs.dirs ~/livecdtmp/edit/etc/skel/.config/user-dirs.dirs
sudo mount -bind /dev/ edit/dev
sudo chroot edit
mount -t proc none /proc && mount -t sysfs none /sys && mount -t devpts none /dev/ptsexport HOME=/root && export LC_ALL=C
mkdir Desktop Documents Downloads Music Pictures Public Templates Videos
Your project is ready for modifications, make whatever changes you want like adding or removing software
jump to step 3: Modify the system
2B. Resume/continue your project
(To continue your project after you have rebooted or just need to make additional changes)
Open a terminal and type/copy:cd livecdtmp
(if you’re not in there already)sudo mount --bind /dev/ edit/dev
sudo chroot edit
mount -t proc none /proc && mount -t sysfs none /sys && mount -t devpts none /dev/pts
At this point you are ready to resume your remaster project
You can add-remove programs and make changes you want.
Jump to step 3. Modify the system
2C. Exit chroot environment
When you’re done making changes in the chroot environment and are still in the chroot environment,
type/copy:apt-get clean
apt-get autoremove
rm -rf /tmp/* ~/.bash_history
umount /proc
umount /sys
umount /dev/pts
exit
sudo umount edit/dev
sudo umount mnt
The project is ready to build or you could go back later to make more changes by repeating step 2B
Jump to step 2B: Resume/continue your project
2D. Build iso
Open a terminal and type/copy :sudo rm ~/livecdtmp/extract-cd/casper/filesystem.squashfs (only if rebuilding a project)
(if you’re not in there already)
cd livecdtmp
sudo mksquashfs edit extract-cd/casper/filesystem.squashfs
sudo nano extract-cd/README.diskdefines
cd extract-cd
sudo rm mdSsum.txt
find -type f -print0 | sudo xargs -0 md5sum | grep -v isolinux/boot.cat | sudo tee mdSsum.txt
cd ..
sudo mkisofs -r -V "Linux_Mint_Remaster" -cache-inodes -J -I -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -o
../Mint-17-Mate-32bit_ Remaster.iso extract-cd
cd ..
sudo chmod 777 Mint-17-Mate-32bit_Remaster.iso
Your project is ready to test
- Modify the system (right after steps 2A and 2B)
Most modifications are done via the chroot terminal
In the chroot terminal you can type commands, install and remove packages. This will modify the ISO you create.
If you just need to edit a text file or add/delete files and don’t want to use the terminal, you can perform this by using a file manager as root instead.
To open a file manager as root in “mate”, press “alt+f2″ for the run command and run
“gksu caja”
The following steps reflect software that I wanted to add/remove and changes that | liked.
You can perform these too, or choose your own
3A. Get all the latest updates
in the chrooted terminal copy/paste the following:apt-get update
thenapt-get upgrade
note: It’s a good idea to reboot right now, after performing all these system updates, the /dev partition won’t unmount so you have to reboot to get things back to normal
To get back to working on your project, go back to step 2B: Resume/continue your project
.
3B. Install software from the repository
in the chrooted terminal, install new software, for exampleapt-get install cheese cairo-dock inkscape testdisk unetbootin grsync gprename shiki-wise-theme
shiki-brave-theme laptop-mode-tools preload gnome-disk-utility skype audacity chntpw extlinux
onboard gufw python-gpgme gpodder patch
3C. Turn on the firewalll by default
in the chrooted terminal copy/paste the followingnano /etc/ufw/ufw.conf
(change the “no” to “yes”, example: ENABLED=yes)
save and exit :
3D. Remove the “Install Mint” icon from the desktop
(Once removed the installer will still be in the control panel)
in the chrooted terminal copy/paste the followingmv /usr/share/applications/ubiquity-gtkui.desktop /usr/share/applications/Install Mint.desktop
3E. Customize fstab to reduce disk writes with the “noatime” option
in the chrooted terminal open the following file to editnano /lib/partman/fstab.d/ext3
find the lines:options="errors=remount-ro”
else
options="${options},errors=remount-ro"
add (without the quotes) “noatime,nodiratime,” right before errors.
It should look like this:options="noatime, nodiratime,errors=remount-ro"
else
options="${options},noatime,nodiratime,errors=remount-ro"
save and exit
3F. Change mintupdate frequency to every 15 days (or longer)
(because updating everyday gets annoying)
from a running system or live CD session
open the update manager and change the settings to your liking.
copy the file ~/.config/linuxmint/mintupdate.conf onto a usb stick
paste the file into your remaster directory to the same location
~/livecdtmp/edit/home/mint/.config/linuxmint/mintupdate.conf
You can also edit the file manually, find the lines:
[refresh]
timer_minutes = 0
timer_hours = 0
timer_days = 15
change to your liking
save and exit
3G. Install extra programs from web:
note: to install the .deb files, copy the files to ~/livecdtmp/edit/
then in the chroot terminal typedpkg -i application_name.deb
once it is done installing you can delete the installer file with this commandrm application_name.deb
to install truecrypt, copy the downloaded file to ~/livecdtmp/edit/
uncompress the file with this commandtar -xvf truecrypt-7.1a-linux-x86.tar.gz
then run the installer./truecrypt-7.1a-linux-x86
then you can delete the installer and compressed file
3H. remove autostart programs
(stop things like remote desktop sharing and upload manager from starting at boot time)
in the chrooted terminal copy/paste the followingcd /etc/xdg/autostart
delete any shortcuts to programs that you don’t want to autostart
3l. set time zone (otherwise time will be shown in UTC)
in the chrooted terminal copy/paste the followingdpkg-reconfigure tzdata
then choose your time zone from the options
3J. Enable automatic updates on a already installed system
** note * Don’t do this on a remaster. it will perform updates every time you boot from the LiveCD/USB
in the chrooted terminal
Install the package “unattended-upgrades”apt-get install unattended-upgrades
edit the sources filenano etc/apt/apt.conf.d/50unattended-upgrades
copy/paste the following right below the line “Unattended-Upgrade::Allowed-Origins {““$distro_id}:${distro_codename}-security";
"${distro_id}:${distro_codename}-updates”;
“linuxmint:rebecca”;
"Ubuntu:trusty-security”,
"Ubuntu:trusty-updates";
“Google\, Inc.:stable";
"Canonical:trusty";
“Insynchaq, Inc.:";
If you have added any repositories and you want them to auto update, you need to add it to this list.
save and exit
create the scheduler config file
touch /etc/apt/apt.conf.d/10periodic
open the new schedule config file for editingnano /etc/apt/apt.conf.d/10periodic
copy/paste the following into the file (this will check for updates once a day)APT::Periodic::Update-Package-Lists "1",
APT::Periodic::Download-Upgradeable-Packages "0";
APT::Periodic::Autocleaninterval "30";
APT::Periodic::Unattended-Upgrade "1";
save and exit
perform a dry run to see if things are working, type
unattended-upgrade –dry-run
open the log file to see the results of the dry runnano /var/log/unattended-upgrades/unattended-upgrades. log
you should see something like this:
2014-09-04 19:20:09,974 INFO Initial blacklisted packages
2014-09-04 19:20:09,974 INFO Starting unattended upgrades script
2014-09-04 19:20:09,975 INFO Allowed origins are: [o=LinuxMint,a=qiana-security’,
‘o=LinuxMint,a=qiana-updates’, ‘o=Ubuntu,a=trusty-security’, ‘o=Ubuntu,a=trusty-updates’
‘o=Google\l, Inc.,a=stable’]
2014-09-04 19:20:12,187 INFO No packages found that can be upgraded unattended
exit nano, this log file will be updated every time the program runs
At this point you are done, just wait a day to see if your updates are performed
If you want to manually run the update type the following
unattended-upgrades
open the log file to see the results of the upgradenano /var/log/unattended-upgrades/unattended-upgrades.log
3K. Mount temporary directories to ram instead of to disk, if privacy/security is desired
** note “ This is something you do on an already installed system
press ALT+F2, enter the command “gksu caja”
navigate to “/etc/” and open “fstab”
‘add the following 3 lines to the end of the text document
tmpfs /tmp tmpfs defaults,noatime,nodiratime,mode=1777 00
tmpfs /var/tmp _tmpfs defaults,noatime,nodiratime,mode=1777 00
tmpfs /var/log tmpfs defauits,noatime.nodiratime,mode=0755 00
save and reboot for changes to take effect
- Personalizing the desktop/theme
These steps will allow you to customize the live user session. The customizations will also carry over to users if your remaster is installed to a disk.
- Boot to your newly created .iso
- Customize it:
after you have booted into the remastered live session go ahead and customize the desktop to your liking.
you can rearrange the panel, change wallpaper, add icons to desktop, add items to the autostart list, pretty much anything. - Log out and back in again
For all your changes to take effect, you must log off from the live user session.
Log back in. username: mint password:__(no password, just press enter) - Save configuration files
have a USB stick handy to copy files into
open a file manager
you should now be in the home folder of the user “mint”
press “ctri+h” to see the hidden files
copy the following folders from the “mint” home folder on to the USB flash drive:
“.config, .gconf, .mateconf, and .mateconfd”
If you have files on the desktop then copy over the “Desktop” folder too. - Reboot
boot back into your own linux installation where you are remastering Linux Mint
open a file manager as root. In Mint Mate edition, press “alt+F2” to bring up the run window. Enter “gksu caja” , press enter and enter your password when prompted
copy the configuration files that you copied on to the USB drive and paste them into your working directory in the following location:
~/livecdtmpedit/etc/skel/
of course, you need to find your own username and working directory name - Rebuild
once the files have been copied over, just rebuild the image like you did the first time
Jump to step 2D. Build .iso - Test
when the image is finished building, burn it to disk, or use “unetbootin” to make a bootable USB stick
Boot into it and test it out. The desktop should look exactly as it did when you customized it on the second step above