Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BBB image deployed with ostree can not install app via apt install ... #5

Closed
bigbearishappy opened this issue Feb 7, 2023 · 5 comments

Comments

@bigbearishappy
Copy link

Normally, we can install the specific app in debian based system with apt install xxx.
But after deploy ostree with it. I find that I can run
sudo apt update
successfully.
When I try to install a app(eg. evtest), I get the following error

debian@beaglebone:~$ sudo apt install evtest
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
  dconf-gsettings-backend dconf-service glib-networking glib-networking-common glib-networking-services
  gsettings-desktop-schemas libarchive13 libavahi-glib1 libdconf1 libfuse2 libgpgme11 libproxy1v5
  libsoup2.4-1
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
  evemu-tools libevdev2 libevemu3
The following NEW packages will be installed:
  evemu-tools evtest libevdev2 libevemu3
0 upgraded, 4 newly installed, 0 to remove and 141 not upgraded.
Need to get 0 B/65.0 kB of archives.
After this operation, 231 kB of additional disk space will be used.
W: Not using locking for read only lock file /var/lib/dpkg/lock-frontend
W: Not using locking for read only lock file /var/lib/dpkg/lock
Do you want to continue? [Y/n] y
dpkg: error: unable to access the dpkg database directory /var/lib/dpkg: Read-only file system
E: Sub-process /usr/bin/dpkg returned an error code (2)

Also, I tried endless OS(debian base, deployed with ostree) with raspberrypi4. The error is same.

Is there a way to fix this problem?
Looking forward to your reply~

@jallwine
Copy link
Member

jallwine commented Feb 7, 2023

Once you set up your system with ostree, most of your file system becomes read only. This is fundamental to how ostree works and allows for a robust update system. That said, I’ve found that you can use ostree admin unlock to temporarily allow writing to your file system via an overlay. On reboot those changes are all lost. You can save them before rebooting by committing the files written to your overlay file system.

sudo ostree admin unlock
sudo apt-get update
sudo apt-get install stlcmd # example package with no dependencies
export OVERLAY_DIR=$(mount | grep overlay | grep -P -o "upperdir=[^,]*" | sed "s/^upperdir=//")
export CURRENT_DEPLOYMENT=$(ostree admin status | head -n 1 | egrep -o '[0-9a-f]{64}')

export BRANCH=development
export ROOT_PATH=/tmp/root
sudo mkdir -p $ROOT_PATH
sudo cp -r -p $OVERLAY_DIR $ROOT_PATH/usr

sudo ostree commit --base=$CURRENT_DEPLOYMENT --tree=dir=$ROOT_PATH --branch=$BRANCH --subject="Installed stlcmd with apt-get" --skip-if-unchanged
sudo ostree admin deploy $BRANCH
sudo reboot

Note that there are limitations to this strategy like the inability to remove files. I haven’t found a way to remove files from an already built image.

@bigbearishappy
Copy link
Author

Thank you for your reply. I just test it with the steps you provided and it works fine.
It's weird that we can't remove file from built image.
Maybe we can try to sync the ostree code with latest upstream, or create a issue to them?

@jallwine
Copy link
Member

jallwine commented Feb 7, 2023

It looks like there has been progress upstream on this, but I’m not familiar enough with the problem to know if it would help here: ostreedev/ostree#2712

@bigbearishappy
Copy link
Author

Thank you. I'll have a try when I need to use it.

@clara081094
Copy link

Hi everyone, I obtained this "PGSQL.5432 not a regular file or symlink" after running "sudo ostree commit --base=$CURRENT_DEPLOYMENT --tree=dir=$ROOT_PATH --branch=$BRANCH --subject="Installed stlcmd with apt-get" --skip-if-unchanged" What can I do to resolve that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants