Advertisement
rucinski69

Instructions for remastering Ubuntu or Linux Mint

Nov 11th, 2018
398
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.71 KB | None | 0 0
  1.  
  2. Instructions for remastering Ubuntu or Linux Mint using squashfs-tools
  3.  
  4. Questions or comments, message me on Google+ https://plus.google.com/+PeteNavarro/posts
  5.  
  6. I made this guide mostly as notes for myself because I like to have my own Live CD/USB with all the programs I like pre-installed and with the desktop set just the way I like. It's also really handy for custom installations of Linux on computers. I used to host this guide on Google Drive, but decided it would be better on it's own webpage.
  7.  
  8. These instructions use squashfs-tools because it should be available on any system, and probably wont go away any time soon.
  9. There have been good programs specific to Ubuntu and Linux Mint that made remastering simple, but have been abandoned or removed by their maintainers.
  10.  
  11. These instructions will work the same on Linux mint 17.01 or Ubuntu 15.10, and probably any Debian based system
  12.  
  13. To keep this guide simple, just copy and paste each line one at a time.
  14. For an explanation of what each step performs, read the original post where I found the instructions: link: Linux Mint Forums
  15.  
  16. Note: a few of the commands are so long that they span 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.
  17. For example, if a command is purple and takes up 3 lines, copy all 3 lines and paste in to your terminal.
  18.  
  19. Sections
  20. 1. Acquire the necessary software
  21. 2A. Create project from scratch
  22. 2B. Resume/continue your project
  23. 2C. Exit chroot environment
  24. 2D. Build .iso
  25. 3. Modify the system
  26. 4. Personalizing the desktop/theme
  27.  
  28.  
  29. 1. Acquire the necessary software
  30.  
  31. 1a. Install packages from the repository
  32.  
  33. Open a terminal and type:
  34.  
  35. sudo apt-get install squashfs-tools genisoimage resolvconf
  36.  
  37. 1b. Download Ubuntu: Ubuntu Downloads page
  38.  
  39. or
  40.  
  41. 1b. Download Linux Mint: Linux Mint downloads page
  42.  
  43. move the downloaded .iso file from your /Downloads folder to your /home/user folder
  44. 2. Setting up, resuming, and building .iso
  45.  
  46. 2A. Create project from scratch
  47.  
  48. Open a terminal and type/copy :
  49.  
  50. mkdir ~/livecdtmp
  51.  
  52. cd ~/livecdtmp
  53.  
  54. mkdir extract-cd mnt
  55.  
  56. sudo mount -o loop ~/INSERT-NAME-HERE.iso mnt (change the name to match the linux image you downloaded)
  57.  
  58. sudo rsync --exclude=/casper/filesystem.squashfs -a mnt/ extract-cd
  59.  
  60. sudo unsquashfs mnt/casper/filesystem.squashfs
  61.  
  62. sudo mv squashfs-root edit
  63.  
  64. sudo cp /etc/resolv.conf edit/etc/
  65.  
  66. sudo mount --bind /dev/ edit/dev
  67.  
  68. sudo chroot edit
  69.  
  70. mount -t proc none /proc && mount -t sysfs none /sys && mount -t devpts none /dev/pts
  71.  
  72. export HOME=/root && export LC_ALL=C
  73.  
  74. cd /etc/skel
  75.  
  76. mkdir Desktop Documents Downloads Music Pictures Public Templates Videos
  77.  
  78. cd /
  79.  
  80. Your project is ready for modifications, make whatever changes you want like adding or removing software
  81.  
  82. Go to step 3 "Modify the system"
  83.  
  84. 2B. Resume/continue your project
  85.  
  86. (To continue your project after you have rebooted or just need to make additional changes)
  87.  
  88. Open a terminal and type/copy :
  89.  
  90. cd livecdtmp (if you're not in there already)
  91.  
  92. sudo mount --bind /dev/ edit/dev
  93.  
  94. sudo chroot edit
  95.  
  96. mount -t proc none /proc && mount -t sysfs none /sys && mount -t devpts none /dev/pts
  97.  
  98. At this point you are ready to resume your remaster project
  99.  
  100. You can add/remove programs and make whatever changes you want.
  101.  
  102. Go to step 3.Modify the system
  103.  
  104. 2C. Exit chroot environment
  105.  
  106. When done making changes and are still in the chroot environment, type/copy :
  107.  
  108. apt-get clean
  109.  
  110. apt-get autoremove
  111.  
  112. rm -rf /tmp/* ~/.bash_history
  113.  
  114. umount /proc
  115.  
  116. umount /sys
  117.  
  118. umount /dev/pts
  119.  
  120. exit
  121.  
  122. sudo umount edit/dev
  123.  
  124. sudo umount mnt
  125.  
  126. The project is ready to build or you could go back later to make more changes by repeating step 2B
  127.  
  128. Go to step 2B: Resume/continue your project
  129.  
  130. 2D. Build .iso
  131.  
  132. Open a terminal and type/copy :
  133.  
  134. sudo rm ~/livecdtmp/extract-cd/casper/filesystem.squashfs (only if rebuilding a project)
  135.  
  136. cd livecdtmp (if you're not in there already)
  137.  
  138. sudo mksquashfs edit extract-cd/casper/filesystem.squashfs
  139.  
  140. sudo nano extract-cd/README.diskdefines
  141.  
  142. cd extract-cd
  143.  
  144. sudo rm md5sum.txt
  145.  
  146. find -type f -print0 | sudo xargs -0 md5sum | grep -v isolinux/boot.cat | sudo tee md5sum.txt
  147.  
  148. cd ..
  149.  
  150. sudo mkisofs -r -V "REMASTER" -cache-inodes -J -l -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -o ../REMASTER.iso extract-cd
  151.  
  152. cd ..
  153.  
  154. sudo chmod 777 REMASTER.iso
  155.  
  156. Your project is ready to test
  157. 3. Modify the system (right after steps 2A and 2B)
  158.  
  159. Most modifications are done via the chroot terminal.
  160. In the chroot terminal you can type commands, install and remove packages as you would on a normally installed system.
  161. These changes will manifest in the ISO you create.
  162.  
  163. 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.
  164.  
  165. The following steps reflect software that I wanted to add/remove and changes that I like
  166. You can perform these too, or choose your own
  167.  
  168. 3A. Get all the latest updates
  169.  
  170. in the chrooted terminal copy/paste the following:
  171.  
  172. apt-get update then
  173. apt-get upgrade
  174.  
  175. 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.
  176.  
  177. To get back to working on your project, go back to step 2B: Resume/continue your project
  178.  
  179. 3B. Install software from the repository
  180.  
  181. in the chrooted terminal, install new software, for example
  182.  
  183. apt-get install inkscape testdisk unetbootin grsync gprename laptop-mode-tools preload audacity chntpw gufw gpodder phatch gimp easytag soundconverter
  184.  
  185. 3C. Turn on the firewall by default
  186.  
  187. in the chrooted terminal copy/paste the following:
  188.  
  189. nano /etc/ufw/ufw.conf (change the “no” to “yes”, example: ENABLED=yes)
  190.  
  191. save and exit
  192.  
  193. 3D. Customize fstab to reduce disk writes with the “noatime” option
  194.  
  195. in the chrooted terminal open the following file to edit:
  196.  
  197. nano /lib/partman/fstab.d/ext3
  198.  
  199. find the lines:
  200.  
  201. options="errors=remount-ro"
  202.  
  203. else
  204.  
  205. options="${options},errors=remount-ro" add (without the quotes) “noatime,nodiratime,” right before errors. It should look like this:
  206.  
  207. options="noatime,nodiratime,errors=remount-ro"
  208.  
  209. else
  210.  
  211. options="${options},noatime,nodiratime,errors=remount-ro" save and exit
  212.  
  213. 3E. Install extra programs from web:
  214.  
  215. Google Chrome: link
  216.  
  217. Hangouts plugin: link
  218.  
  219. Teamviewer: link
  220.  
  221. Truecrypt: link
  222.  
  223. Insync: link
  224.  
  225. Dropbox: link
  226.  
  227. Boot-Repair: link
  228.  
  229. Indicator Stickynotes: link
  230. 4. Personalizing the desktop/theme
  231.  
  232. 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.
  233.  
  234. Boot to your newly created .iso
  235. Customize it:
  236.  
  237. after you have booted into the remastered live session go ahead and customize the desktop to your liking.
  238. you can rearrange the panel, change wallpaper, add icons to desktop, add items to the autostart list. pretty much anything.
  239.  
  240. Log out and back in again
  241.  
  242. For all your changes to take effect, you must log off from the live user session.
  243. Log back in. username: mint password:__________(no password, just press enter)
  244.  
  245. Save configuration files
  246.  
  247. have a USB stick handy to copy files into
  248. open a file manager
  249. you should now be in the home folder of the user “mint”
  250. press “ctrl+h” to see the hidden files
  251. copy the following folders from the “mint” home folder on to the USB flash drive:
  252. “.config, .gconf, .mateconf, and .mateconfd”
  253. If you have files on the desktop then copy over the “Desktop” folder too.
  254.  
  255. Reboot
  256.  
  257. boot back into your own linux installation where you are remastering Linux Mint
  258. 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
  259. copy the configuration files that you copied on to the USB drive and paste them into your working directory in the following location:
  260. ~/livecdtmp/edit/etc/skel/
  261. of course, you need to find your own username and working directory name
  262.  
  263. Rebuild
  264.  
  265. once the files have been copied over, just rebuild the image like you did the first time
  266. Jump to step 2D. Build .iso
  267.  
  268. Test
  269.  
  270. when the image is finished building, burn it to disk, or use “unetbootin” to make a bootable USB stick.
  271. boot into it and test it out.
  272. the desktop should look exactly as it did when you customized it on the second step above.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement