Reputation: 151
Running Ubuntu 18.04 LTS. I've put a script in the following location:
/usr/share/initramfs-tools/scripts/init-bottom/dothis
dothis
is set as +x. I've run sudo update-initramfs -u
which appears to update the initramfs contents just fine. I've looked at /boot/grub/grub.cfg
and see the expected initrd file configured.
Running lsinitramfs
on the file DOES show the script as having been added.
I cannot however find any evidence that dothis
is being run on boot. As per documentation online, the root filesystem SHOULD be in place by the time the /init-bottom
scripts are run, which should be the only thing required for my 'hello world' to work, as it outputs to a file on the root file system.
Is there some other step that needs to be done in order to get this script to run, or show whether it's being run? I've tried to simply output text to a file in /tmp but this is not showing up either.
Upvotes: 3
Views: 2023
Reputation: 189
Since you did not provide more details, I have to guess. Does your dothis
script write to /tmp
inside the initramfs? The root file system is mounted at /root
and the initramfs uses switch_root
to switch to it (as last step of the initramfs). Then all files written to /tmp
are lost. If you let your script write to /root/root/log
, this file will appear in /root/log
on the booted system.
To further debug your issue, you can boot your system with the kernel parameter break=bottom
. Then you get a shell where you can run your script manually. For even faster debug cycles, you can use a virtual machine.
Upvotes: 0