Skip to content

Instantly share code, notes, and snippets.

@kevinmeziere
Created January 2, 2020 21:02
Show Gist options
  • Save kevinmeziere/0680da5afee47d02ec92fb8850585b60 to your computer and use it in GitHub Desktop.
Save kevinmeziere/0680da5afee47d02ec92fb8850585b60 to your computer and use it in GitHub Desktop.
Fix makedev package on Ubuntu 14.04 for Joyent SmartOS LX zones
Unfortunately the Ubuntu makedev package fails to detect it's in a container environment on SmartOS LX zones, resulting in errors of the form:
# apt-get install nano
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
nano
0 upgraded, 1 newly installed, 0 to remove and 141 not upgraded.
1 not fully installed or removed.
Need to get 194 kB of archives.
After this operation, 614 kB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu/ trusty/main nano amd64 2.2.6-1ubuntu1 [194 kB]
Fetched 194 kB in 0s (2,963 kB/s)
Selecting previously unselected package nano.
(Reading database ... 74430 files and directories currently installed.)
Preparing to unpack .../nano_2.2.6-1ubuntu1_amd64.deb ...
Unpacking nano (2.2.6-1ubuntu1) ...
Processing triggers for man-db (2.6.7.1-1ubuntu1) ...
Setting up makedev (2.3.1-93ubuntu2~ubuntu14.04.1) ...
mknod: ‘mem-’: Operation not permitted
makedev mem c 1 1 root kmem 0640: failed
mknod: ‘kmem-’: Operation not permitted
makedev kmem c 1 2 root kmem 0640: failed
mknod: ‘null-’: Operation not permitted
makedev null c 1 3 root root 0666: failed
...
To fix this, we can make a customised makedev package with an empty postinst script.
# Make custom makedev package
mkdir -p /root/makedev
cd /root/makedev
apt-get download makedev
dpkg-deb -x makedev*.deb
dpkg-deb -e makedev*.deb
rm *.deb
echo -en '#!/bin/bash\nexit 0\n' > DEBIAN/postinst
dpkg-deb -b . ../makedev.deb
rm -rf /root/makedev
# Replace existing makedev package
dpkg -r --force-depends makedev
dpkg -i /root/makedev.deb
# Pin makedev so our version doesn't get replaced
cat << MAKEDEV > $INSTALL_DIR/etc/apt/preferences.d/makedev
Package: makedev
Pin: release *
Pin-Priority: -1
MAKEDEV
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment