Uninstall built-in package in 5.20 firmware and other

Marvell Kirkwood based
Post Reply
bobwinch
Posts: 6
Joined: Fri Jan 20, 2017 6:35 pm

Uninstall built-in package in 5.20 firmware and other

Post by bobwinch » Fri Jan 20, 2017 7:04 pm

Hello all,

I'm a frenchman discovering the Zyxel universe, expanded thanks to you all!

I just bought a Zyxel Nas326, and this forum has been a big help to configure what I need.

However I have some noob questions, unanswered despite me reading a lot of forum pages :

1) How can I uninstall the backup-planner built-in app?

It's running zysync, which itself is blocking rsync from starting (which is weird considering zysync does not seem to run on the port 22).

I would like to get rid of zysync for good, and I think it is the only way.

2) Or can I uninstall zysync without uninstalling backup-planner? Or make the app use rsync?

3) I killed the zysync process, installed entware-ng, then installed rsync.

It's working for now, but I need to be sure that zysync will be killed on every startup, before rsync is initiated.

Inside entware, I added the following in /etc/init.d/s50rsyncd : PREARGS="killall zysync".

Do you think it can work?

Is there a better method?

4) Last question : is there any solution to get rsync not only in /opt/bin, but also in /usr/local/bin ?

When I try to create a symlink, I get the following error : systemfile read-only.

It's a pain because I always have to use the rsync option "--rsync_path".

The issue is that some linux packages dont let you add any rsync option.

I was using backup-manager to backup files from a debian 8 server to my former nas.

Now I have to use duplicity and backup-ninja, which is not bad, but I think that this issue could present itself in the future with other packages.

Sorry if my english is bad and thanks in advance.

Mijzelf
Posts: 6197
Joined: Mon Jun 16, 2008 10:45 am

Re: Uninstall built-in package in 5.20 firmware and other

Post by Mijzelf » Sat Jan 21, 2017 1:11 pm

I'm not aware of any way to uninstall the backup planner. It's on a read-only loopmounted firmware file, but your way of killing zysync before starting rsync is fine.
(which is weird considering zysync does not seem to run on the port 22).
Port 22 is ssh. Zysync and rsync use the rsync port (duh!) 873. You can see that with

Code: Select all

netstat -lptn
4) Last question : is there any solution to get rsync not only in /opt/bin, but also in /usr/local/bin ?
Yes, that can be done. I'm aware of at least 2 different ways.
  • mount.sda1.rw.flag
    A part of the firmware is in 'sysdisk.img', a single file containing an ext2 filesystem. This file is loopmounted on /ram_bin, and part of it's content (/ram_bin/usr) is bindmounted on /usr.
    Normally that filesystem is read-only, but by putting a flag on disk, it will be mounted rw, which gives you the opportunity to put a symlink in /usr/bin/.
    The procedure to set that flag is:

    Code: Select all

    mount -o remount,rw /firmware/mnt/sysdisk
    touch /firmware/mnt/sysdisk/mount.sda1.rw.flag
    mount -o remount,ro /firmware/mnt/sysdisk
    reboot
    All changes you made in /usr will be reverted if you remove the flag and reboot. (A fresh sysdisk.img will be extracted from flash). You can read about this flag in the /etc/init.d/rcS startscript.

    Of course there is a drawback. This flag will cause firmware updates to be done half. A new kernel/initramfs, but not a new sysdisk.img. Worst case this might cause a not fully booting box. (The scripts in initramfs assume a new sysdisk.img. The old one might be incompatible).
  • Mounting magic.
    /ram_bin/usr is bindmounted on /usr. Which means you can reach to all binaries in /usr/bin/ via /ram_bin/usr/bin/. This creates an opportunity to mount a ramdrive on /usr/bin

    Code: Select all

    #!/bin/sh
    
    # Create a ramdrive:
    mkdir /mnt/ramdrive
    mount -t tmpfs tmpfs /mnt/ramdrive
    
    # Create symlinks on it:
    for file in $( ls /usr/bin )
    do
        # Check if it's a symlink
        if readlink /usr/bin/${file} >/dev/null
        then
            cp -a /usr/bin/${file} /mnt/ramdrive/
        else
            ln -s /ram_bin/usr/bin/${file} /mnt/ramdrive/${file}
        fi
    done
    
    # Move ramdrive 
    mount --move /mnt/ramdrive /usr/bin
    Now you have a writeable /usr/bin/, and you can add your own symlinks. Of course you'll have to execute that script on each boot.

bobwinch
Posts: 6
Joined: Fri Jan 20, 2017 6:35 pm

Re: Uninstall built-in package in 5.20 firmware and other

Post by bobwinch » Sun Jan 22, 2017 12:22 pm

Thanks a lot for your answer.

I'm gonna have to study it a little bit because some of it is way over my actual skillset ! :lol:

bobwinch
Posts: 6
Joined: Fri Jan 20, 2017 6:35 pm

Re: Uninstall built-in package in 5.20 firmware and other

Post by bobwinch » Mon Jan 23, 2017 12:16 pm

Well, now I discover that the root /home folder is erased at each startup, thus erasing my ssh keys.

How can I move the root home folder? usermod -d gives me the following error : user root currently logged in.

Logging as admin gives me a permission denied error.

Mijzelf
Posts: 6197
Joined: Mon Jun 16, 2008 10:45 am

Re: Uninstall built-in package in 5.20 firmware and other

Post by Mijzelf » Mon Jan 23, 2017 1:44 pm

usermod won't help you, as the whole /etc directory is also erased.

(Well, technically, it isn't erased, and /root isn't either. But they are both on a ramdrive (initramfs), and the data isn't preserved on shutdown.)

You can use the Tweaks package to move the homedirectory of root.

bobwinch
Posts: 6
Joined: Fri Jan 20, 2017 6:35 pm

Re: Uninstall built-in package in 5.20 firmware and other

Post by bobwinch » Mon Jan 23, 2017 3:12 pm

Ok, thank you, I'll try that tonight.

bobwinch
Posts: 6
Joined: Fri Jan 20, 2017 6:35 pm

Re: Uninstall built-in package in 5.20 firmware and other

Post by bobwinch » Mon Jan 23, 2017 11:25 pm

It's working as intended.

Thanks again !

Post Reply