Tiny Core Linux

Tiny Core Extensions => TCE Q&A Forum => Topic started by: h2sammo on January 21, 2019, 06:14:35 PM

Title: Remove USB stick after boot
Post by: h2sammo on January 21, 2019, 06:14:35 PM
Is it possible to remove the USB stick after boot, then reinsert it before shutdown and have all changes saved to it as if it was never removed? Some of these sticks are quite long and I hate bumping into them as I move the laptop around.

i tried (of course), but upon re-insertion of the USB stick, it mounted with different name so there was an error upon trying to save the changes from the RAM layer.

thank you
Title: Re: Remove USB stick after boot
Post by: Rich on January 21, 2019, 07:11:12 PM
Hi h2sammo
That may be a little tricky. You can't have persistent  home  or  opt  directories on the stick. You need a  copy2fs.flg  file
in your  tce  directory so your extensions get copied instead of loop mounted. You should then be able to unmount the
stick and remove it. When you reinsert it and mount it, you can use the  Backup/Restore  tool in the  Control Panel  to
change the backup location if the mount point changed.
Title: Re: Remove USB stick after boot
Post by: h2sammo on January 22, 2019, 05:33:49 PM
i think such an automated feature would be highly beneficial and would add great value to tinycore. i hate bumping the USB stick into furniture as i clumsily move my laptop around. others may as well.
Title: Re: Remove USB stick after boot
Post by: Rich on January 22, 2019, 07:05:34 PM
Hi h2sammo
Quote
i tried (of course), but upon re-insertion of the USB stick, it mounted with different name ...
Did you unmount it first or did you just yank it out? If you can't unmount it, it means something on the stick is being accessed
and it should not be unplugged.
Title: Re: Remove USB stick after boot
Post by: h2sammo on January 26, 2019, 05:23:19 PM
i cannot umount the partition on which the home and tce directory are. They are set as persistent in my boot codes. Do you think thats the reason why i cannot umount or a different reason?
Title: Re: Remove USB stick after boot
Post by: Rich on January 26, 2019, 05:46:50 PM
Hi h2sammo
That's exactly why you can't unmount them.
Title: Re: Remove USB stick after boot
Post by: coreplayer2 on January 26, 2019, 06:32:41 PM
i think such an automated feature would be highly beneficial and would add great value to tinycore. i hate bumping the USB stick into furniture as i clumsily move my laptop around. others may as well.
Hey h2sammo
Get yourself a modern USB thumb drive,  like this 64GB USB3 thumb drive smaller than my thumb nail which I couldn’t bump into if I tried

(https://uploads.tapatalk-cdn.com/20190127/9ad0078ec88cbc64f272e006877ed2a7.jpg)
And there are a wealth of even smaller usb drives available today

Sent from my iPhone using Tapatalk
Title: Re: Remove USB stick after boot
Post by: h2sammo on January 27, 2019, 03:01:10 AM
yeah, thats a good suggestion coreplayer2. i bought the fastest read/write stick i found, but its pretty bulky, the size of my thumb. i enjoy the much faster boot/shutdown time. i guess i will look around for small AND fast. i still think an option for running completely from RAM should be automated.

i think this is already possible, load complete core into RAM then look for label or UUID for backup. its just that it would be nice to be automated for noobs or semi-noobs such as myself.
Title: Re: Remove USB stick after boot
Post by: curaga on January 27, 2019, 11:05:58 AM
It pretty much is.

1. Don't use persistent home/opt
2. Enable copy2fs (in Apps, the Toggle copy2fs option)
3. In your boot options, use label or uuid for the tce dir, and in bootlocal.sh, unmount the drive

The backup script is smart enough to try to mount the device if it's not mounted.
Title: Re: Remove USB stick after boot
Post by: h2sammo on January 27, 2019, 09:28:09 PM
ok, i tested removing the USB, making changes to home directory, then reinserting and rebooting the system. changes were backed up properly. I followed your 3 steps.

this is my grub.cfg for core10:
Code: [Select]
menuentry "CorePlus 10" {
search --no-floppy --fs-uuid --set=root 60557b80-7de2-401d-aa5e-a8f88b6a4a62
linux /boot10.0/vmlinuz loglevel=3 waitusb=3 showapps desktop=flwm_topside laptop tce=LABEL=data/tce10.0 acpi_osi= syslog
initrd /boot10.0/core.gz

i am not sure if the search --no-floppy...... line is needed. I dont have anything similar on other linux OS i boot with same grub.cfg file. I added it based on a post i saw online. Is it necessary?
Title: Re: Remove USB stick after boot
Post by: curaga on January 28, 2019, 12:30:55 AM
Presumably it saves some time not to check for floppies.
Title: Remove USB stick after boot
Post by: coreplayer2 on January 28, 2019, 02:44:32 AM
this is my grub.cfg for core10:
Code: [Select]
menuentry "CorePlus 10" {
search --no-floppy --fs-uuid --set=root 60557b80-7de2-401d-aa5e-a8f88b6a4a62
linux /boot10.0/vmlinuz loglevel=3 waitusb=3 showapps desktop=flwm_topside laptop tce=LABEL=data/tce10.0 acpi_osi= syslog
initrd /boot10.0/core.gz

i am not sure if the search --no-floppy...... line is needed. I dont have anything similar on other linux OS i boot with same grub.cfg file. I added it based on a post i saw online. Is it necessary?

Hello h2sammo

I’d be more concerned with waitusb=3, showapps & desktop=flwm_topside, than with the search line of your boot config


I’d replace “waitusb=3” which iirc will wait 3 seconds every time you boot before continuing. 
Whereas with
Code: [Select]
waitusb=5:LABEL=data the process waits typically only 1 second until the drive with the specified label “data” is found then stops counting and continues with the boot process.

“showapps” IMO is only for diagnosis and troubleshooting.  It’s definitely not required besides I prefer to boot with the minimum fuss when the system is operating normally.

“desktop=flwm_topside”  this is another way to load a window manager from various boot selections instead of having several onboot lists, but honestly after installing TC to a HDD or USB I find it’s better to have all my extensions load from one source ie: “onboot.lst”.  Also if you like to change window managers less frequently it’s usually easier to add flwm_topside.tcz  via  APPS > maintenance > onboot
I’d add flwm_topside.tcz to your onboot.lst and remove the bootcode

Also note while the tce directories for various Tinycore versions must be separate, you can store all your tinycore files (and modules if you use separate module archives) for different versions in one location if you rename the files.

Eg:
/boot/core-90.gz
/boot/core-100.gz
/boot/vmlinuz-41410
/boot/vmlinuz-41910

And adjust your grub config file accordingly.
I use this method, makes sense right?

Good luck


Sent from my iPhone using Tapatalk
Title: Re: Remove USB stick after boot
Post by: h2sammo on January 28, 2019, 09:24:21 PM
thank you for the explanation.

if i comment out this line
Code: [Select]
search --no-floppy --fs-uuid --set=root 60557b80-7de2-401d-aa5e-a8f88b6a4a62

boot sequence cannot find vmlinuz. So i let the line stay. I dont understand why i dont need it for this grub menu for a different OS (excuse the crossover or "infidelity")

Code: [Select]
menuentry "Fatdog64 with savefile in USB device with hugeinitrd" {
linux /vmlinuz rootfstype=ramfs waitdev=3 savefile=ram:usb
initrd /initrd

this suggestion is golden and i didnt know how this worked previously:
Code: [Select]
waitusb=5:LABEL=data

also i didnt know that i dont need the desktop=flwm_topside as a boot code. I already have it in  my onboot.lst - thank you.

my current grub menu:
Code: [Select]
menuentry "CorePlus 10" {
search --no-floppy --fs-uuid --set=root 60557b80-7de2-401d-aa5e-a8f88b6a4a62
linux /boot10.0/vmlinuz loglevel=3 waitusb=5:LABEL=data laptop tce=LABEL=data/tce10.0 acpi_osi= syslog
initrd /boot10.0/core.gz
}
Title: Re: Remove USB stick after boot
Post by: Juanito on January 28, 2019, 11:16:31 PM
So is "acpi_osi=" what fixes your function key/special key problems?
Title: Re: Remove USB stick after boot
Post by: h2sammo on January 28, 2019, 11:30:28 PM
i will try to identify the exact item which is responsible for key recognition. this is my onboot.lst
Code: [Select]
Xvesa.tcz
aterm.tcz
wbar.tcz
wifi.tcz
wl-modules-4.19.10-tinycore.tcz
iw.tcz
pci-utils.tcz
ndiswrapper.tcz
firmware-atheros.tcz
firmware-broadcom_bcm43xx.tcz
firmware-broadcom_bnx2.tcz
firmware-broadcom_bnx2x.tcz
firmware-getB43.tcz
firmware-ipw2100.tcz
firmware-ipw2200.tcz
firmware-iwimax.tcz
firmware-iwl8000.tcz
firmware-iwl9000.tcz
firmware-iwlwifi.tcz
firmware-marvel.tcz
firmware-myri10ge.tcz
firmware-netxen.tcz
firmware-openfwwf.tcz
firmware-ralinkwifi.tcz
firmware-rtl8192ce_se_de.tcz
firmware-rtlwifi.tcz
firmware-ti-connectivity.tcz
firmware-ueagle-atm.tcz
firmware-vxge.tcz
firmware-zd1211.tcz
firmware.tcz
tc-install-GUI.tcz
ezremaster.tcz
wireless-rtl8822be-4.19.10-tinycore.tcz
laptop-mode-tools.tcz
input-tablet-touchscreen-4.19.10-tinycore.tcz
xbindkeys.tcz
xf86-input-synaptics.tcz
graphics-4.19.10-tinycore.tcz
Xorg-7.7.tcz
xf86-video-intel.tcz
flwm_topside.tcz

you can see the grub menu in previous post.
its a bit tricky to eliminate the unneeded onboot/boot code options because i am going back and forth between 2 laptops. one thing is for certain, i had acpi_osi= without xbindkeys config file and i didnt have key recognition. now keys are recognized as F2 or F3 on one laptop and fn+F2 or fn+F3 on the other.

Code: [Select]
# Increase backlight
"xbacklight -inc 10"
   XF86MonBrightnessUp
# Decrease backlight
"xbacklight -dec 10"
   XF86MonBrightnessDown

# Examples of commands:

"xbindkeys_show"
  control+shift + q

# set directly keycode (here control + f with my keyboard)
"xterm"
  c:41 + m:0x4

# specify a mouse button
"xterm"
  control + b:2


what is your opinion?
Title: Re: Remove USB stick after boot
Post by: Juanito on January 29, 2019, 12:19:45 AM
You can remove the following from onboot.lst

Xvesa - not needed if you are using Xorg-7.7
wl-modules-4.19.10-tinycore.tcz - recursive dep of wifi
iw - not needed if you are using wifi
ndiswrapper - you are using wireless-rtl8822be-4.19.10-tinycore
firmware* - the one you need, firmware-rtlwifi, is a dep of wireless-rtl8822be-4.19.10-tinycore
tc-install-GUI - would be be better in ondemand.list
ezremaster - would be be better in ondemand.list

special key recognition is a function of the bios, manufacturers kernel driver and Xorg-7.7, not xbindkeys - once Xorg has recognised the special keystroke (cf "xev -event keyboard"), xbindkeys does something with the signal that the key has been pressed.
Title: Re: Remove USB stick after boot
Post by: polikuo on February 23, 2019, 06:11:09 AM
In my case, I'd do
Code: [Select]
sudo umount /dev/sdx
eject /dev/sdx
before unplugging my USB.

Later on, I'd reinsert my USB and mount it for the backup.

Usually, by doing so, the USB device letter (/dev/sdx) would be preserved.